FileDialog Path
Hi,
I need to save path which was last using by SaveFileDialog to saving file. But I can't find this path.
I checked all items in Environment, Application, Configuration and I not finded that.
Is there any solution to find this path?
This has been previously answered
http://social.msdn.microsoft.com/Forums/vstudio/en-US/c43ddefb-1274-4ceb-9cda-c78d860b687c/how-to-get-the-last-directory-after-open-filedialog
also try this link
http://stackoverflow.com/questions/9821344/how-to-remember-the-last-path-when-insert-files-into-listbox
and you can try this
public static string GetLastOpenSaveFile(string extention)
RegistryKey regKey = Registry.CurrentUser;
string lastUsedFolder = string.Empty;
regKey = regKey.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ComDlg32\\OpenSaveMRU");
if (string.IsNullOrEmpty(extention))
extention = "html";
RegistryKey myKey = regKey.OpenSubKey(extention);
if (myKey == null && regKey.GetSubKeyNames().Length > 0)
myKey = regKey.OpenSubKey(regKey.GetSubKeyNames()[regKey.GetSubKeyNames().Length - 2]);
if (myKey != null)
string[] names = myKey.GetValueNames();
if (names != null && names.Length > 0)
lastUsedFolder = (string)myKey.GetValue(names[names.Length - 2]);
return lastUsedFolder;
Similar Messages
-
Opening a file with custom FileDialog. (VERY URGENT)
hi everybody,
I have a problem and stuck. I have developed a MDI application that provides all function like open saved files, create new, edit and lots of other. It only opens, save ,edit etc the graphical diagrams inside JInternalFrames. I have an icon on my desktop when clicked opens this Application. Just like Editplus, Word or some other application when you click on the icon it opens that. Same way I have created such functionality.
Now instead of this I have created a custom FileDialogfrom which the user selects this application and is opened. Now I have small icon for this FileDialog on the desktop when opened gives the interface to select the files to be opened. My FileDialog just looks like the FileDialog but some more functionality and more components like JComboBox, Jlist, JtextField, JButtons etc. in it and have removed some of them. I am extending JDialog. But now my probelm is when you select a file and click open, it should open the selected file. How can I achive this functionality in my custom FileDialog as I am not extending FileDialog and as it is built in the FileDialog. How can I open the files with any extension in it's related application e.g .doc files to be opened in MicrosoftWord, .txt to be opened in notepad, .c or .cpp in Visual Studio C++ etc.
How can I put this kind of functionality in my custom FileDialog. It's really important for me please any comments will help me alot. Thanks for the helpHello,
I think you can write :
Runtime.getRuntime().exec("start.exe " + MyFileDialog.getDirectory() + MyFileDialog.getFile());
So, "start.exe" choose the application (not valid for NT machine), ".getDirectory()" return the PATH and ".getFile()" return the NAME.
Best regards from France
Thierry -
Hi all!
Currently I want to allow user to select the file path using those file dialog like JFileChooser/FileDialog... So that there's an input field that accepts a file name... Then another text field which will display the path that the user chose... I need to do that separately to write a .wav file... How do I do it?
I tried using JFileChooser and set this... (.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);) It only shows the directories, yes... But if I open a directory... without anymore directories in it... When I click on the "OK" button... It does not allow me to go on...
CozelHow about this???
import java.io.*;
public class MyFileChooser extends javax.swing.JDialog {
private javax.swing.JPanel cntrPnl;
private javax.swing.JFileChooser chsr;
private javax.swing.JButton cancelButton;
private javax.swing.JButton svButton;
private javax.swing.JTextField dirField;
private java.io.File selFile = null;
public MyFileChooser(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
private void initComponents() {
chsr = new javax.swing.JFileChooser();
cntrPnl = new javax.swing.JPanel();
dirField = new javax.swing.JTextField();
svButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
closeDialog(evt);
chsr.setControlButtonsAreShown(false);
chsr.setDialogType(javax.swing.JFileChooser.CUSTOM_DIALOG);
chsr.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chsrActionPerformed(evt);
chsr.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
chsrPropertyChange(evt);
getContentPane().add(chsr, java.awt.BorderLayout.CENTER);
dirField.setEditable(false);
dirField.setMargin(new java.awt.Insets(0, 5, 0, 5));
dirField.setPreferredSize(new java.awt.Dimension(200, 30));
cntrPnl.add(dirField);
svButton.setText("SAVE");
svButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
svButtonActionPerformed(evt);
cntrPnl.add(svButton);
cancelButton.setText("Cancel");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
cntrPnl.add(cancelButton);
getContentPane().add(cntrPnl, java.awt.BorderLayout.SOUTH);
pack();
private void chsrPropertyChange(java.beans.PropertyChangeEvent evt) {
dirField.setText(chsr.getCurrentDirectory().getAbsolutePath());
private void svButtonActionPerformed(java.awt.event.ActionEvent evt) {
selFile=chsr.getSelectedFile();
this.hide();
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
selFile = null;
this.hide();
private void chsrActionPerformed(java.awt.event.ActionEvent evt) {
dirField.setText(chsr.getCurrentDirectory().getAbsolutePath());
private void closeDialog(java.awt.event.WindowEvent evt) {
setVisible(false);
dispose();
public static void main(String args[]) {
MyFileChooser fc = new MyFileChooser(null, true);
fc.show();
File f = fc.getSelFile();
if(f!=null)
System.out.println("Selected File is: "+f);
fc.dispose();
System.exit(0);
public File getSelFile() {
return selFile;
}walker -
Issues with file path in java.io.File
I am getting file path in eclipse plugin using org.eclipse.swt.widgets.FileDialog and saving the path in XML files.
In web.xml , path is stored as below (I can't change backsladh to forwardslash or escape backslash since the value is coming from SWT FileDialog)
<init-param>
<param-name>filePath</param-name>
<param-value>c:\new\demo\next\version.txt</param-value>
</init-param>
In my filter , i have below code in init() method but am not able to get File reference due to special characters
String filePath = filterConfig.getInitParameter("filePath");
// Tried filePath.replace('\\','/') --> Didnot work since \n is a single character
File f = new File(path)No it does not. You need to escape file paths properly. You can check this with simple code and that the problem i am facing now
public static void main(String[] args) {
String path = Messages.getString("filePath"); //in messages.properties put filePath=c:\new\next\verison.txt
System.out.println(path);
File f = new File(path);
System.out.println(f.exists());
} -
Can't set directory path in a JTextField
I've tried to set some directory paths in a JTextField, but nothing displayed in that the JTextField. However, i can print the directory paths one at a time to the console. The following is the code and will explain what I am trying to do:
fileDialog.showOpenDialog(this);
File[] classpath = fileDialog.getSelectedFiles();
if(classpath.length == 0)
return;
String cp = "";
for(int i = 0; i<classpath.length; i++){
//System.out.println(classpath.getPath());
cp.concat(classpath[i].getAbsolutePath());
System.out.println(cp);
jTextField_cp.setText(cp);
if I uncomment the first print statement,each path will be shown on a new line in the console. But when I want to print the pathes of the directories in one time( concatenate them first), there's no output at all (the second print statement), I only got some empty new lines in the console. Is it any problems with the use of "cp.concat()" method?I'm pretty sure that it'll work if you replace your concat line with this.
cp = cp.concat(classpath.getAbsolutePath());Java strings are passed by the value of their references, so you are only manipulating the value of the reference, the the string itself, unlike other objects. To work around that, assign cp the new string returned from the concat method. -
Save last path from webutil file dialog
Hello!
Is it possible, or how is it possible to save every client's "last path" from choosing files with webutil?
When we used forms 6, the standard Windows file dialog appeared and it's saving the last path where a file was choosen. With the "new" webutil filedialog this behavior changed and it always opens at the "initial" directory.
Is there any solution to this?
Thanks in advance for helpIf you are using the WebUtil_File.File_Open_Dialog() function, you can specify the directory_name as a parameter. When you open a file for the first time in your form, just capture the directory location to a variable and pass this in subsequent calls. Unfortunately, since your form is now Web Deployed, Forms uses Java to display a File Open Dialog so it doesn't retail the last location opened.
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Hi,
i am new in event handling programs and i make a small program using FileDialog . but FileDialog is nor working properly .
here is my code
import java.awt.event.*;
import java.awt.*;
import java.io.*;
public class frameopen extends Frame
frameopen f;
String msg = "";
Panel p1 = new Panel();
Panel p2 = new Panel();
Label l = new Label("Enter URL");
Label l2 = new Label("");
TextField t = new TextField(50);
Button b = new Button("OPEN");
Button b1 = new Button("Browse");
public frameopen()
public void frame(frameopen object)
f=object;
setTitle("FILE OPENER");
setBackground(Color.cyan);
setForeground(Color.red);
setSize(600,200);
setLocation(250,250);
p1.add(l);
p1.add(t);
p1.add(b1);
p2.add(b);
p1.add(l2);
add("North",p1);
add("Center",p2);
b.addMouseListener(new my(b));
b1.addMouseListener(new my(b1));
addWindowListener(new my1());
class my extends MouseAdapter
Button temp;
String s;
my(Button obj)
temp=obj;
s=temp.getLabel();
public void mousePressed(MouseEvent evt)
if(s.equals(b.getLabel()))
try
File f1 = new File(t.getText());
if(f1.exists())
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + f1.getAbsolutePath());
else
msg = " File Not Found. Please Check URL.";
error e1 = new error(f,msg);
e1.setVisible(true);
catch (Exception e)
msg = "" + e;
error e1 = new error(f,msg);
e1.setVisible(true);
else
try
File fd = new File(f,"SELECT");
fd.setVisible(true);
t.setText(fd.text());
catch (Exception e)
msg = "" + e;
error e1 = new error(f,msg);
e1.setVisible(true);
class my1 extends WindowAdapter
public void windowClosing(WindowEvent evt)
System.exit(0);
public static void main(String args[])
frameopen f = new frameopen();
f.frame(f);
f.setVisible(true);
class error extends Dialog implements ActionListener
String msg = "";
Panel p = new Panel();
Panel p1 = new Panel();
Label l = new Label();
Button b= new Button("OK");
error(Frame parent ,String title)
super(parent , "ERROR" , false);
setSize(300,100);
setLocation(150,50);
msg = title ;
l.setText(msg);
p.add(l);
p1.add(b);
add("North",p);
add("Center",p1);
b.addActionListener(this);
addWindowListener(new my());
public void actionPerformed(ActionEvent evt)
dispose();
class my extends WindowAdapter
public void windowClosing(WindowEvent evt)
dispose();
class file extends FileDialog implements ActionListener
file ob = new file();
file(Frame obj , String Title)
super(f,title);
public void windowClosing(ActionEvent evt)
dispose();
public String text()
String msg = ob.getDirectory()+ ob.getFile();
in this code all is running well except FileDialog which is extended in file class. event handling of other component are also effected by FileDialog. on executing this code i got one text file of name
**hs_err_pid3208**
and the matter inside the file is
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7ca2cd53, pid=3208, tid=1320
# Java VM: Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode)
# Problematic frame:
# C [SHELL32.DLL+0x6cd53]
--------------- T H R E A D ---------------
Current thread (0x0acae058): JavaThread "AWT-Windows" daemon [_thread_in_native, id=1320]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
Registers:
EAX=0x00000000, EBX=0x000df570, ECX=0x000df570, EDX=0x7c90eb94
ESP=0x0af5d49c, EBP=0x0af5d4b0, ESI=0x000df570, EDI=0x000df6dc
EIP=0x7ca2cd53, EFLAGS=0x00010246
Top of Stack: (sp=0x0af5d49c)
0x0af5d49c: 000df6dc 00000000 000df570 ffffffff
0x0af5d4ac: 00000000 0af5d504 7c9f8268 00000001
0x0af5d4bc: 00000000 000af0a0 0af5d538 00002000
0x0af5d4cc: 0af5d498 0af5d4e0 0af5e450 77d7046f
0x0af5d4dc: 77d48840 ffffffff 77d4883a 00010015
0x0af5d4ec: 000ba0f8 00000000 002a01ec 0000000b
0x0af5d4fc: 00000000 00000000 0af5d538 7ca2cf8a
0x0af5d50c: 00000003 00000063 00000000 00000000
Instructions: (pc=0x7ca2cd53)
0x7ca2cd43: 83 4d f8 ff 83 65 fc 00 53 56 57 8b f1 8b 46 3c
0x7ca2cd53: 8b 08 8d 96 38 02 00 00 52 8d 55 f8 52 6a 08 bf
Stack: [0x0af20000,0x0af60000), sp=0x0af5d49c, free space=245k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [SHELL32.DLL+0x6cd53]
C [SHELL32.DLL+0x38268]
C [SHELL32.DLL+0x6cf8a]
C [COMDLG32.DLL+0x46d4]
C [COMDLG32.DLL+0x44cc]
C [COMDLG32.DLL+0x433c]
C [COMDLG32.DLL+0x3eed]
C [COMDLG32.DLL+0x3e41]
C [COMDLG32.DLL+0x3dc4]
C [COMDLG32.DLL+0x3a84]
C [COMDLG32.DLL+0x3678]
C [USER32.dll+0x8744]
C [USER32.dll+0x15324]
C [USER32.dll+0x14d17]
C [USER32.dll+0x14f44]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb8ab]
C [USER32.dll+0x15b68]
C [USER32.dll+0x16f01]
C [USER32.dll+0x16f56]
C [USER32.dll+0x22066]
C [COMDLG32.DLL+0x35de]
C [COMDLG32.DLL+0x33e5]
C [COMDLG32.DLL+0x33bc]
C [COMDLG32.DLL+0x17cc7]
C [awt.dll+0xcf68d]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb8ab]
C [USER32.dll+0xb913]
C [awt.dll+0xcf682]
C [awt.dll+0xe56e4]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb4d0]
C [USER32.dll+0xb51c]
C [ntdll.dll+0xeae3]
C [USER32.dll+0x9412]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.awt.windows.WToolkit.eventLoop()V+0
j sun.awt.windows.WToolkit.run()V+69
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0ac6ac10 JavaThread "Thread-1" daemon [_thread_in_native, id=3212]
0x0ac6a9e8 JavaThread "SIGTERM handler" daemon [_thread_blocked, id=3360]
0x0ac69150 JavaThread "Thread-10" [_thread_in_native, id=2884]
0x00035858 JavaThread "DestroyJavaVM" [_thread_blocked, id=3204]
0x0acb3b18 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3232]
=>0x0acae058 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1320]
0x0acadca0 JavaThread "AWT-Shutdown" [_thread_blocked, id=2836]
0x00acdb30 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1636]
0x00a93f28 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1392]
0x00a92af8 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3220]
0x00a91ed8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1356]
0x00a88ed8 JavaThread "Finalizer" daemon [_thread_blocked, id=1404]
0x00a87a90 JavaThread "Reference Handler" daemon [_thread_blocked, id=1408]
Other Threads:
0x00a47fb0 VMThread [id=1412]
0x00a95108 WatcherThread [id=1340]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 373K [0x02ad0000, 0x02b70000, 0x02fb0000)
eden space 512K, 60% used [0x02ad0000, 0x02b1d4a8, 0x02b50000)
from space 64K, 100% used [0x02b60000, 0x02b70000, 0x02b70000)
to space 64K, 0% used [0x02b50000, 0x02b50000, 0x02b60000)
tenured generation total 1408K, used 191K [0x02fb0000, 0x03110000, 0x06ad0000)
the space 1408K, 13% used [0x02fb0000, 0x02fdfef0, 0x02fe0000, 0x03110000)
compacting perm gen total 8192K, used 3898K [0x06ad0000, 0x072d0000, 0x0aad0000)
the space 8192K, 47% used [0x06ad0000, 0x06e9eb38, 0x06e9ec00, 0x072d0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000 C:\jdk1.5.0_08\bin\java.exe
0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x6d730000 - 0x6d8cb000 C:\jdk1.5.0_08\jre\bin\client\jvm.dll
0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x6d2f0000 - 0x6d2f8000 C:\jdk1.5.0_08\jre\bin\hpi.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d700000 - 0x6d70c000 C:\jdk1.5.0_08\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\jdk1.5.0_08\jre\bin\java.dll
0x6d720000 - 0x6d72f000 C:\jdk1.5.0_08\jre\bin\zip.dll
0x6d070000 - 0x6d1d9000 C:\jdk1.5.0_08\jre\bin\awt.dll
0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.dll
0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
0x6d2b0000 - 0x6d2ef000 C:\jdk1.5.0_08\jre\bin\fontmanager.dll
0x10000000 - 0x10007000 C:\Internet Download Manager\idmmkb.dll
0x7c9c0000 - 0x7d399000 C:\WINDOWS\system32\SHELL32.DLL
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2649_x-ww_aac16c8b\comctl32.dll
0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\comctl32.dll
0x763b0000 - 0x763f9000 C:\WINDOWS\system32\COMDLG32.DLL
0x77b40000 - 0x77b62000 C:\WINDOWS\system32\appHelp.dll
0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL
0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll
0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x77a20000 - 0x77a74000 C:\WINDOWS\System32\cscui.dll
0x76600000 - 0x7661d000 C:\WINDOWS\System32\CSCDLL.dll
0x75f80000 - 0x7607d000 C:\WINDOWS\system32\browseui.dll
0x769c0000 - 0x76a73000 C:\WINDOWS\system32\USERENV.dll
0x77920000 - 0x77a13000 C:\WINDOWS\system32\SETUPAPI.dll
0x76990000 - 0x769b5000 C:\WINDOWS\system32\ntshrui.dll
0x76b20000 - 0x76b31000 C:\WINDOWS\system32\ATL.DLL
0x5b860000 - 0x5b8b5000 C:\WINDOWS\system32\NETAPI32.dll
0x77760000 - 0x778cf000 C:\WINDOWS\system32\shdocvw.dll
0x77a80000 - 0x77b14000 C:\WINDOWS\system32\CRYPT32.dll
0x77b20000 - 0x77b32000 C:\WINDOWS\system32\MSASN1.dll
0x754d0000 - 0x75550000 C:\WINDOWS\system32\CRYPTUI.dll
0x76c30000 - 0x76c5e000 C:\WINDOWS\system32\WINTRUST.dll
0x76c90000 - 0x76cb8000 C:\WINDOWS\system32\IMAGEHLP.dll
0x771b0000 - 0x77259000 C:\WINDOWS\system32\WININET.dll
0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
0x20000000 - 0x202c9000 C:\WINDOWS\system32\xpsp2res.dll
0x75e90000 - 0x75f40000 C:\WINDOWS\system32\SXS.DLL
0x71b20000 - 0x71b32000 C:\WINDOWS\system32\MPR.dll
0x75f60000 - 0x75f67000 C:\WINDOWS\System32\drprov.dll
0x71c10000 - 0x71c1e000 C:\WINDOWS\System32\ntlanman.dll
0x71cd0000 - 0x71ce7000 C:\WINDOWS\System32\NETUI0.dll
0x71c90000 - 0x71cd0000 C:\WINDOWS\System32\NETUI1.dll
0x71c80000 - 0x71c87000 C:\WINDOWS\System32\NETRAP.dll
0x71bf0000 - 0x71c03000 C:\WINDOWS\System32\SAMLIB.dll
0x75f70000 - 0x75f79000 C:\WINDOWS\System32\davclnt.dll
0x0b600000 - 0x0b658000 C:\WINDOWS\system32\PortableDeviceApi.dll
0x4d4f0000 - 0x4d548000 C:\WINDOWS\system32\WINHTTP.dll
0x75970000 - 0x75ade000 C:\WINDOWS\system32\MSGINA.dll
0x76360000 - 0x76370000 C:\WINDOWS\system32\WINSTA.dll
0x74320000 - 0x7435d000 C:\WINDOWS\system32\ODBC32.dll
0x0b8a0000 - 0x0b8b7000 C:\WINDOWS\system32\odbcint.dll
0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
VM Arguments:
java_command: frameope
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\jdk1.5.0_08\
CLASSPATH=.;c:\Tomcat\common\lib\servlet.jar;C:\tomcat\common\lib\servlet-api.jar;C:\classes\jl1.0.jar;C:\classes\mp3spi1.9.2.jar;C:\classes\tritonus_share.jar
PATH=C:\jdk1.5.0_08\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Sun\AppServer\bin;;C:\jdk1.5.0_08\bin
USERNAME=abhishek
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 1 (cores per cpu 1, threads per core 1) family 15 model 2 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 253424k(68724k free), swap 620672k(203748k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_08-b03) for windows-x86, built on Jul 26 2006 01:10:50 by "java_re" with MS VC++ 6.0
PLEASE HELP ME TO UNDERSTAND THISdude
their is a prblm in FileDialog nt in my coding coz i got one file of after the execution of this code
which states that their is aprblm in java hotspot virtual machine. Here is a content of the file and if u run this prgrm thn i
think u also get tht. nd i m using java1.5
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7ca2cd53, pid=1576, tid=560
# Java VM: Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode)
# Problematic frame:
# C [SHELL32.DLL+0x6cd53]
--------------- T H R E A D ---------------
Current thread (0x0acae058): JavaThread "AWT-Windows" daemon [_thread_in_native, id=560]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
Registers:
EAX=0x00000000, EBX=0x000cd7d8, ECX=0x000cd7d8, EDX=0x7c90eb94
ESP=0x0af5d49c, EBP=0x0af5d4b0, ESI=0x000cd7d8, EDI=0x000cd944
EIP=0x7ca2cd53, EFLAGS=0x00010246
Top of Stack: (sp=0x0af5d49c)
0x0af5d49c: 000cd944 00000000 000cd7d8 ffffffff
0x0af5d4ac: 00000000 0af5d504 7c9f8268 00000001
0x0af5d4bc: 00000000 000af2a8 0af5d538 00002000
0x0af5d4cc: 0af5d498 0af5d4e0 0af5e450 77d7046f
0x0af5d4dc: 77d48840 ffffffff 77d4883a 00010015
0x0af5d4ec: 000c3498 00000000 000d01f4 0000000b
0x0af5d4fc: 00000000 00000000 0af5d538 7ca2cf8a
0x0af5d50c: 00000003 00000063 00000000 00000000
Instructions: (pc=0x7ca2cd53)
0x7ca2cd43: 83 4d f8 ff 83 65 fc 00 53 56 57 8b f1 8b 46 3c
0x7ca2cd53: 8b 08 8d 96 38 02 00 00 52 8d 55 f8 52 6a 08 bf
Stack: [0x0af20000,0x0af60000), sp=0x0af5d49c, free space=245k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [SHELL32.DLL+0x6cd53]
C [SHELL32.DLL+0x38268]
C [SHELL32.DLL+0x6cf8a]
C [COMDLG32.DLL+0x46d4]
C [COMDLG32.DLL+0x44cc]
C [COMDLG32.DLL+0x433c]
C [COMDLG32.DLL+0x3eed]
C [COMDLG32.DLL+0x3e41]
C [COMDLG32.DLL+0x3dc4]
C [COMDLG32.DLL+0x3a84]
C [COMDLG32.DLL+0x3678]
C [USER32.dll+0x8744]
C [USER32.dll+0x15324]
C [USER32.dll+0x14d17]
C [USER32.dll+0x14f44]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb8ab]
C [USER32.dll+0x15b68]
C [USER32.dll+0x16f01]
C [USER32.dll+0x16f56]
C [USER32.dll+0x22066]
C [COMDLG32.DLL+0x35de]
C [COMDLG32.DLL+0x33e5]
C [COMDLG32.DLL+0x33bc]
C [COMDLG32.DLL+0x17cc7]
C [awt.dll+0xcf68d]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb8ab]
C [USER32.dll+0xb913]
C [awt.dll+0xcf682]
C [awt.dll+0xe56e4]
C [USER32.dll+0x8744]
C [USER32.dll+0x8826]
C [USER32.dll+0xb4d0]
C [USER32.dll+0xb51c]
C [ntdll.dll+0xeae3]
C [USER32.dll+0x9412]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.awt.windows.WToolkit.eventLoop()V+0
j sun.awt.windows.WToolkit.run()V+69
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0ac6b1b8 JavaThread "Thread-1" daemon [_thread_in_native, id=256]
0x0acc1cc8 JavaThread "SIGTERM handler" daemon [_thread_blocked, id=1648]
0x00aca2e8 JavaThread "Thread-6" [_thread_in_native, id=928]
0x00035858 JavaThread "DestroyJavaVM" [_thread_blocked, id=1824]
0x0acb3900 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=800]
=>0x0acae058 JavaThread "AWT-Windows" daemon [_thread_in_native, id=560]
0x0acadca0 JavaThread "AWT-Shutdown" [_thread_blocked, id=1220]
0x00acdb08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=892]
0x00a93f28 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1740]
0x00a92c28 JavaThread "CompilerThread0" daemon [_thread_blocked, id=148]
0x00a91d08 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1240]
0x00a88ed8 JavaThread "Finalizer" daemon [_thread_blocked, id=1904]
0x00a87a90 JavaThread "Reference Handler" daemon [_thread_blocked, id=1644]
Other Threads:
0x00a47fb0 VMThread [id=1984]
0x00a95108 WatcherThread [id=1232]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 376K [0x02ad0000, 0x02b70000, 0x02fb0000)
eden space 512K, 61% used [0x02ad0000, 0x02b1e260, 0x02b50000)
from space 64K, 100% used [0x02b60000, 0x02b70000, 0x02b70000)
to space 64K, 0% used [0x02b50000, 0x02b50000, 0x02b60000)
tenured generation total 1408K, used 194K [0x02fb0000, 0x03110000, 0x06ad0000)
the space 1408K, 13% used [0x02fb0000, 0x02fe0ad8, 0x02fe0c00, 0x03110000)
compacting perm gen total 8192K, used 3920K [0x06ad0000, 0x072d0000, 0x0aad0000)
the space 8192K, 47% used [0x06ad0000, 0x06ea42e8, 0x06ea4400, 0x072d0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000 C:\jdk1.5.0_08\bin\java.exe
0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x6d730000 - 0x6d8cb000 C:\jdk1.5.0_08\jre\bin\client\jvm.dll
0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x6d2f0000 - 0x6d2f8000 C:\jdk1.5.0_08\jre\bin\hpi.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d700000 - 0x6d70c000 C:\jdk1.5.0_08\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\jdk1.5.0_08\jre\bin\java.dll
0x6d720000 - 0x6d72f000 C:\jdk1.5.0_08\jre\bin\zip.dll
0x6d070000 - 0x6d1d9000 C:\jdk1.5.0_08\jre\bin\awt.dll
0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.dll
0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
0x6d2b0000 - 0x6d2ef000 C:\jdk1.5.0_08\jre\bin\fontmanager.dll
0x10000000 - 0x10007000 C:\Internet Download Manager\idmmkb.dll
0x7c9c0000 - 0x7d399000 C:\WINDOWS\system32\SHELL32.DLL
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2649_x-ww_aac16c8b\comctl32.dll
0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\comctl32.dll
0x763b0000 - 0x763f9000 C:\WINDOWS\system32\COMDLG32.DLL
0x77b40000 - 0x77b62000 C:\WINDOWS\system32\appHelp.dll
0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL
0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll
0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x77a20000 - 0x77a74000 C:\WINDOWS\System32\cscui.dll
0x76600000 - 0x7661d000 C:\WINDOWS\System32\CSCDLL.dll
0x75f80000 - 0x7607d000 C:\WINDOWS\system32\browseui.dll
0x769c0000 - 0x76a73000 C:\WINDOWS\system32\USERENV.dll
0x77920000 - 0x77a13000 C:\WINDOWS\system32\SETUPAPI.dll
0x76990000 - 0x769b5000 C:\WINDOWS\system32\ntshrui.dll
0x76b20000 - 0x76b31000 C:\WINDOWS\system32\ATL.DLL
0x5b860000 - 0x5b8b5000 C:\WINDOWS\system32\NETAPI32.dll
0x77760000 - 0x778cf000 C:\WINDOWS\system32\shdocvw.dll
0x77a80000 - 0x77b14000 C:\WINDOWS\system32\CRYPT32.dll
0x77b20000 - 0x77b32000 C:\WINDOWS\system32\MSASN1.dll
0x754d0000 - 0x75550000 C:\WINDOWS\system32\CRYPTUI.dll
0x76c30000 - 0x76c5e000 C:\WINDOWS\system32\WINTRUST.dll
0x76c90000 - 0x76cb8000 C:\WINDOWS\system32\IMAGEHLP.dll
0x771b0000 - 0x77259000 C:\WINDOWS\system32\WININET.dll
0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
VM Arguments:
java_command: frameopen
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\jdk1.5.0_08\
CLASSPATH=.;c:\Tomcat\common\lib\servlet.jar;C:\tomcat\common\lib\servlet-api.jar;C:\classes\jl1.0.jar;C:\classes\mp3spi1.9.2.jar;C:\classes\tritonus_share.jar
PATH=C:\jdk1.5.0_08\bin;E:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Sun\AppServer\bin;;C:\jdk1.5.0_08\bin
USERNAME=abhishek
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 9, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 1 (cores per cpu 1, threads per core 1) family 15 model 2 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 253424k(66708k free), swap 620672k(257232k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_08-b03) for windows-x86, built on Jul 26 2006 01:10:50 by "java_re" with MS VC++ 6.0 -
FileDialog usage - having general problem
I have a class that extends FileDialog in my application. I have a working File dialog box that opens, I set it to FileDialog.SAVE type.
I would like the FileDialog to initially display the String
"Whatever.txt" in the filename field. The setText() command for this class isn't what I want, but I do not know what else to look at and this is all I've tried.
also, and most importantly, when user hits Save button on the FileDialog I want to have a handle to this action because I create a txt file of String records and save to the current path.
thanks ahead of time,
jmschreiany help or redirection to specific API location would be greatly appreciated..
thanks again,
jmschrei -
How do I calculate the size of files that I have UNC paths for
I am on SQL Server 2008 R2. I have a table that contains a field called [Location]. In that field is a UNC path to the physical file on the repository. Is there a way in SQL Server that I can say give me the select sum([Location] UNC file) where criteria?
I saw some posts about xp_filesize or xp_GetFileDetails, but I do not see them in master. I am unable to add anything and wondering if there is any native functionality that would allow me to accomplish this!? Thanks.Maybe you can use an Excel Macro for this kind of thing.
Dim iRow
Sub ListFiles()
iRow = 11
Call ListMyFiles(Range("C7"), Range("C8"))
End Sub
Sub ListMyFiles(mySourcePath, IncludeSubfolders)
Set MyObject = New Scripting.FileSystemObject
Set mySource = MyObject.GetFolder(mySourcePath)
On Error Resume Next
For Each myFile In mySource.Files
iCol = 2
Cells(iRow, iCol).Value = myFile.Path
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.Name
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.Size
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.DateLastModified
iRow = iRow + 1
Next
If IncludeSubfolders Then
For Each mySubFolder In mySource.SubFolders
Call ListMyFiles(mySubFolder.Path, True)
Next
End If
End Sub
Try this too.
Sub TestListFilesInFolder()
' Open folder selection
' Open folder selection
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select a Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo NextCode
pPath = .SelectedItems(1)
If Right(pPath, 1) <> "\" Then
pPath = pPath & "\"
End If
End With
NextCode: 'MsgBox "No files Selected!!"
'Application.WindowState = xlMinimized
'Application.ScreenUpdating = False
Workbooks.Add ' create a new workbook for the file list
' add headers
ActiveSheet.Name = "ListOfFiles"
With Range("A2")
.Formula = "Folder contents:"
.Font.Bold = True
.Font.Size = 12
End With
Range("A3").Formula = "File Name:"
Range("B3").Formula = "File Size:"
Range("C3").Formula = "File Type:"
Range("D3").Formula = "Date Created:"
Range("E3").Formula = "Date Last Accessed:"
Range("F3").Formula = "Date Last Modified:"
Range("A3:F3").Font.Bold = True
Worksheets("ListOfFiles").Range("A1").Value = pPath
Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
ListFilesInFolder Worksheets("ListOfFiles").Range("A1").Value, True
' list all files included subfolders
Range("A3").Select
Lastrow = Range("A1048576").End(xlUp).Row
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("ListOfFiles").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("ListOfFiles").Sort.SortFields.Add Key:=Range( _
"B4:B" & Lastrow), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("ListOfFiles").Sort
.SetRange Range("A3:F" & Lastrow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
Cells.Select
Cells.EntireColumn.AutoFit
Columns("A:A").Select
Selection.ColumnWidth = 100
Range("A1").Select
End Sub
Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders As Boolean)
' lists information about the files in SourceFolder
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
r = Range("A1048576").End(xlUp).Row + 1
For Each FileItem In SourceFolder.Files
' display file properties
Cells(r, 1).Formula = FileItem.Path & FileItem.Name
Cells(r, 2).Formula = (FileItem.Size / 1048576)
Cells(r, 2).Value = Format(Cells(r, 2).Value, "##.##") & " MB"
Cells(r, 3).Formula = FileItem.Type
Cells(r, 4).Formula = FileItem.DateCreated
Cells(r, 5).Formula = FileItem.DateLastAccessed
Cells(r, 6).Formula = FileItem.DateLastModified
' use file methods (not proper in this example)
r = r + 1 ' next row number
Next FileItem
If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFilesInFolder SubFolder.Path, True
Next SubFolder
End If
Columns("A:F").AutoFit
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
ActiveWorkbook.Saved = True
End Sub
Sub CreateList()
Application.ScreenUpdating = False
Workbooks.Add ' create a new workbook for the folder list
' add headers
ActiveSheet.Name = "ListOfFiles"
With Cells(3, 1)
.Value = "Folder contents:"
.Font.Bold = True
.Font.Size = 12
End With
Cells(4, 1).Value = "Folder Path:"
Cells(4, 2).Value = "Folder Name:"
Cells(4, 3).Value = "Folder Size:"
Cells(4, 4).Value = "# Subfolders:"
Cells(4, 5).Value = "# Files:"
Range("A3:E3").Font.Bold = True
ListFolders BrowseFolder, True
Application.ScreenUpdating = True
Cells.Select
Cells.EntireColumn.AutoFit
Columns("A:A").Select
Selection.ColumnWidth = 100
Columns("B:B").Select
Selection.ColumnWidth = 25
Range("A1").Select
End Sub
Sub ListFolders(SourceFolderName As String, IncludeSubfolders As Boolean)
' lists information about the folders in SourceFolder
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
' display folder properties
Worksheets("ListOfFiles").Range("A1").Value = SourceFolderName
Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
r = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(r, 1).Value = SourceFolder.Path
Cells(r, 2).Value = SourceFolder.Name
Cells(r, 3).Value = SourceFolder.Size
Cells(r, 3).Value = (SourceFolder.Size / 1048576)
Cells(r, 3).Value = Format(Cells(r, 3).Value, "##.##") & " MB"
Cells(r, 4).Value = SourceFolder.SubFolders.Count
Cells(r, 5).Value = SourceFolder.Files.Count
If IncludeSubfolders Then
For Each SubFolder In SourceFolder.SubFolders
ListFolders SubFolder.Path, True
Next SubFolder
Set SubFolder = Nothing
End If
Columns("A:E").AutoFit
Set SourceFolder = Nothing
Set FSO = Nothing
ActiveWorkbook.Saved = True
End Sub
And, finally.
Const BIF_RETURNONLYFSDIRS As Long = &H1 ''' For finding a folder to start document searching
Const BIF_DONTGOBELOWDOMAIN As Long = &H2 ''' Does not include network folders below the domain level in the tree view control
Const BIF_RETURNFSANCESTORS As Long = &H8 ''' Returns only file system ancestors.
Const BIF_BROWSEFORCOMPUTER As Long = &H1000 ''' Returns only computers.
Const BIF_BROWSEFORPRINTER As Long = &H2000 ''' Returns only printers.
Const BIF_BROWSEINCLUDEFILES As Long = &H4000 ''' Returns everything.
Const MAX_PATH As Long = 260
Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszINSTRUCTIONS As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Declare Function SHGetPathFromIDListA Lib "shell32.dll" (ByVal pidl As Long, ByVal pszBuffer As String) As Long
Declare Function SHBrowseForFolderA Lib "shell32.dll" (lpBrowseInfo As BROWSEINFO) As Long
Function BrowseFolder() As String
Const szINSTRUCTIONS As String = "Choose the folder to use for this operation." & vbNullChar
Dim uBrowseInfo As BROWSEINFO
Dim szBuffer As String
Dim lID As Long
Dim lRet As Long
With uBrowseInfo
.hOwner = 0
.pidlRoot = 0
.pszDisplayName = String$(MAX_PATH, vbNullChar)
.lpszINSTRUCTIONS = szINSTRUCTIONS
.ulFlags = BIF_RETURNONLYFSDIRS
.lpfn = 0
End With
szBuffer = String$(MAX_PATH, vbNullChar)
''' Show the browse dialog.
lID = SHBrowseForFolderA(uBrowseInfo)
If lID Then
''' Retrieve the path string.
lRet = SHGetPathFromIDListA(lID, szBuffer)
If lRet Then BrowseFolder = Left$(szBuffer, InStr(szBuffer, vbNullChar) - 1)
End If
BrowseFolder = BrowseFolder & "\"
End Function
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
If image file not exist in image path crystal report not open and give me exception error problem
Hi guys my code below show pictures for all employees
code is working but i have proplem
if image not exist in path
crystal report not open and give me exception error image file not exist in path
although the employee no found in database but if image not exist in path when loop crystal report will not open
how to ignore image files not exist in path and open report this is actually what i need
my code below as following
DataTable dt = new DataTable();
string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
using (SqlConnection con = new SqlConnection(connString))
con.Open();
SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
foreach (DataRow dr in dt.Rows)
FileStream fs = null;
fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] imgbyte = new byte[fs.Length + 1];
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
dr["Image"] = imgbyte;
fs.Dispose();
ReportDocument objRpt = new Reports.CrystalReportData2();
objRpt.SetDataSource(dt);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
and exception error as belowFirst: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
Second : Drag And drop this image Filed Where I want.
private void LoadReport()
frmCheckWeigher rpt = new frmCheckWeigher();
CryRe_DailyBatch report = new CryRe_DailyBatch();
DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
DataTable dt = GetImageRow(table, "Footer.Jpg");
report.SetDataSource(dt);
crv1.ReportSource = report;
crv1.Refresh();
By this Function I merge My Image data into dataTable
private DataTable GetImageRow(DataTable dt, string ImageName)
try
FileStream fs;
BinaryReader br;
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
else
// if photo does not exist show the nophoto.jpg file
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
// initialise the binary reader from file streamobject
br = new BinaryReader(fs);
// define the byte array of filelength
byte[] imgbyte = new byte[fs.Length + 1];
// read the bytes from the binary reader
imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
dt.Rows[0]["Image"] = imgbyte;
br.Close();
// close the binary reader
fs.Close();
// close the file stream
catch (Exception ex)
// error handling
MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
return dt;
// Return Datatable After Image Row Insertion
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
Error while creating a Characteristic Variable with Replacement Path
Hi all,
I am trying to create the Characteristic Variable ZVLOWDT (Low Date') with Replacement Path on characteristic ZSTARTDT (Start Date) and it gives the error 'Source to replace 'Low Date' is not defined.
I have created a User Entry Variable VAR_DATE (Start Date) with interval like '01/01/2009 - 01/15/2009' and Customer Exit variable ZVCPDAY (does some calculation based on the input of VAR_DATE) on the same ZSTARTDT characteristic. I want to get the 01/01/2009 (lower range date of the selection) into this Characteristic Variable ZVLOWDT. We are in BI 7.0 and the following are it's properties:
General Tab:
Description: Low Date
Technical Name: ZVLOWDT
Type of Variable: Characteristic Value
Processing by: Replacement Path
Reference Characteristic: ZSTARTDT Start Date
Details Tab:
Variable Represents : Single value
Variable is: Mandatory
Variable is Ready for Input : unchecked
Replacement Path Tab: Replacement Rule
Replace Variable with : Variable
Variable : VAR_DATE
Replace with : KEY
Why I am getting this error, PLEASE ?
Thanks,
Venkat.Hi Khaja,
We could derive a Variable value from another Variable with out Customer Exit. There is a white paper.
First have the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next create the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we could get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path, PLEASE ?
Thanks,
Venkat. -
Logical filename and logical path in lsmw
Hi all,
I am doing a lsmw for purchasing info record . i created a logicalpath and assigned a physical path to that . i created a logical filename and assigned the logical path .but when i assign that to the lsmw it is throwing error as 'LOGICAL PATH DOES NOT POINT TO PHYSICAL DIRECTORY' .
can anybody provide a solution for that .
Thanks & regards
Magesh anandanhi ,
goto the tcode file then u find the relation between the logical and physical paths ...and their assignment..
hope it will helps u..
regards,
venkat. -
Relative path for images in RTF templates
Hi everybody!
When I insert an image in a RTF template, I put its path into the web dialog, in order to see correctly the picture when I open the report from the xmlp server, in this way: url:{"http://servername/analytics/res/Images/image.bmp"}
How can I make this path relative, in order to see the images even if the server name changes?
Thanks so!
FrancescoHi Tim,
I am using BIP 10.1.3.3.2. I am able to access system variable CURRENT_SERVER URL.
Steps:
<?param@begin:CURRENT_SERVER_URL?>
<xsl:value-of select="$ CURRENT_SERVER_URL"/>
CURRENT_SERVER_URL is getting printed in BI Publisher. Value displayed is http://xx4697.xxx.co.in:9704/xmlpserver.
Now we are importing xsl into RTF template. File aaa.xsl is stored at [BIP_Installation_Directory\oc4j_bi\j2ee\home\default-web-app]
We have hardcoded the path for XSL in RTF. The path is <?import: http://xx4697.xxx.co.in:9704/aaa.xsl?>
As we want to set dynamic path we changed hardcoded xsl path to <?import: {$CURRENT_SERVER_URL}/../aaa.xsl?> but it is not working. Sometimes BIP is taking local path of MyDocuments folder and sometimes Desktop path. If I put that XSL file in MyDocuments folder or Desktop, it is working fine. But ideally it should refer [BIP_Installation_Directory\oc4j_bi\j2ee\home\default-web-app] path...
Thanks,
Amit D -
Emails from camera roll saved to wrong folder -- IMAP Path Prefix Problem
I think there's a problem with the behaviour of the way picture emails are saved when you have an IMAP Path Prefix.
I have an IMAP Path Prefix of "INBOX"... i.e. my sent folder is Inbox/Sent. Any plaintext emails I send from the email application from the iPhone are correctly saved to that folder and I can see them in that folder immediately via the iPhone's interface.
When I navigate to the camera roll or photo album and send a picture email to somebody, and use the iPhone to go view the sent folder, they never appear in the sent folder. For a while I thought they weren't being saved at all, but I just discovered from my home PC that the camera roll app is indeed saving them somewhere: in Inbox/Inbox/Sent.
That's right--I now have a new Inbox folder inside my Inbox folder, with just a Drafts and Sent folder. Drafts is Empty, Sent has all the picture emails I've ever sent with the iPhone.
Bug? I think so... Emails emanating from the camera app are taking the IMAP Path Prefix twice instead of once, and then creating that Path Prefix folder if it doesn't already exist.
Anybody else with an IMAP Path Prefix experiencing this with picture emails from the camera roll?
Thanks,
Andi
Windows XP ProAhhh interesting to find someone else with the same problem! It definitely happens when you send a photo message. My mac mail it shows my Inbox with a new nested sent items folder. I am using fusemail and the iPhone seriously messes with the folder structure. All sent items folders vanished for some reason on the mail server (but not in mac mail oddly) and I had to call technical support to make them reappear. I think this happened when I altered the Settings, Mail, Advanced settings, Mail box behaviour folders after having this problem with sent photo messages.
Now fusemail's webserver shows TWO Inboxes, one nested inside the other, and a "Sent Items" folder within the "new" inboxes.
Totally strange. I think there is a bug or two in the iPhone's IMAP software. Hoping for a bug fix soon, but until then perhaps a good work around might be to set the iPhone to store sent messages locally? -
Blends: Difference between open and closed paths modifying spine
Okay, just had a discovery today about the blend tool.
The difference between closed paths and open paths is critical when you want to modify a blend spine, such as make it curve. Between open paths, there is no spine shown when a blend is created. Ever notice this? Between closed paths, there is a spine, which can be modified, such as making it curved. Now, the trick is how to modify a spine with open paths when there is no spine shown. Found out today that starting with a closed path, segments can be deleted to make the path open, then the spine can be modified and the open path state maintained!
This is a huge bug in Illustrator and makes no sense to me. Wanting Adobe to fix this in the next major release. Hope this helps anyone struggling with this issue.One thing you should be aware of concerning open ended splines:
It makes an enormous difference as to how the blend behaves whether the endpoints have handles or not.
Give them handles and you will find that you can alter the distribution of the blend objects just by adjusting the handles or by dragging on the spline itself.
Give it a try.
Maybe you are looking for
-
About getting the values from a FM
Hi experts, I have used the function module 'HR_READ_INFOTYPE' to get all the field values of the infotype 0008 (Basic Pay). I have given the infty as 0008 in exporting and infty_tab as p0008 in tables. But it shows a run time error
-
Line with 0 quantity for main item with batch split
Hello experts, I have one line item in delivery. Delivery split is there: There are 1 spilt items with 1 batch nos. The main item category and the batch split item category are TAN. My system is showing 2 line items in billing, the batch line with qu
-
Trouble displaying A drop down list in Contribute
I am having trouble with a client that has downloaded Contribute onto their windows computer. The page in question contains a drop-down nav- bar which I coded using CSS. I have had the page certified by W3 CSS and the html also went through at 100%.
-
BBP_WFL_SECUR_BADI triggered twice
Hi Gurus, I am using BADI BBP_WFL_SECUR_BADI to retrigger workflow when user make changes to certain fields in the shopping cart. First I check SCENARIO is initial, then I use function BBP_PD_SC_GETDETAIL to get screen values, then I called function
-
Guys, I have posted in SDN regarding what all scenarios i have to practice to work in a real time project, i got a good response.....Thanks for all of them. I have worked on File, Mail,JDBC,IDOC adaptors. Worked on Message mapping. Worked on File -fi