| View previous topic :: View next topic |
| Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed Feb 27, 2008 11:06 am Post subject: [HELP] OpenFileDialog at C# |
|
|
i have made a button that open the openfiledialog and when i choose a file i want that the file's directory will be saved in some String... how can i do it ?
_________________
Stylo |
|
| Back to top |
|
 |
GuM Expert Cheater
Reputation: 0
Joined: 17 Jan 2007 Posts: 185 Location: The Netherlands
|
Posted: Wed Feb 27, 2008 12:19 pm Post subject: |
|
|
I don't know C#, so not sure how I can do it in C#, but here's an example of how you can do that in Delphi. I'm sure you can convert that to C#.
| Code: | var
saveDialog : TSaveDialog; // Save dialog variable
LolString: String;
begin
saveDialog := TSaveDialog.Create(self); //Create Save dialog
//blabla
saveDialog.Execute; //Open Save Dialog
LolString := SaveDialog.FileName; //Save chosen filename in a string
saveDialog.Free;
end; |
That's save dialog, but I'm pretty sure that open dialog is almost the same.
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed Feb 27, 2008 12:59 pm Post subject: |
|
|
nvm i got this working few minutes ago but thanks any way..
btw i have another problem...
how can i get the location of some Folder / Directory in my computer into a string variable?
_________________
Stylo |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Feb 27, 2008 2:36 pm Post subject: |
|
|
System.IO.Directory.Exists
System.IO.Directory.GetDirectories
System.IO.Directory.GetDirectoryRoot
System.IO.Directory.GetCurrentDirectory
just look around in System.IO
i use this program to simply move my bot dll, and rename it to PCOMDebug.dll at MapleStory's directory... cuz im that lazy
| Code: | static void Main(string[] args)
{
if ( System.IO.File.Exists( "C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll" ) )
System.IO.File.Delete( "C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll" );
System.IO.File.Copy("C:\\Documents and Settings\\Kyle\\My Documents\\Visual Studio 2008\\Projects\\lBot v2\\Release\\lBot Win32 DLL.dll",
"C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll");
System.Console.WriteLine("File Moved and Renamed... Exiting Now");
System.Threading.Thread.Sleep(1000);
} |
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Feb 27, 2008 2:55 pm Post subject: |
|
|
| Look at the methods, there's stuff to get the current directory, etc.
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Wed Feb 27, 2008 2:57 pm Post subject: |
|
|
| lurc wrote: | System.IO.Directory.Exists
System.IO.Directory.GetDirectories
System.IO.Directory.GetDirectoryRoot
System.IO.Directory.GetCurrentDirectory
just look around in System.IO
i use this program to simply move my bot dll, and rename it to PCOMDebug.dll at MapleStory's directory... cuz im that lazy :P
| Code: | static void Main(string[] args)
{
if ( System.IO.File.Exists( "C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll" ) )
System.IO.File.Delete( "C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll" );
System.IO.File.Copy("C:\\Documents and Settings\\Kyle\\My Documents\\Visual Studio 2008\\Projects\\lBot v2\\Release\\lBot Win32 DLL.dll",
"C:\\Program Files\\Nexon\\MapleStory\\PCOMDebug.dll");
System.Console.WriteLine("File Moved and Renamed... Exiting Now");
System.Threading.Thread.Sleep(1000);
} |
|
Good idea, Kyle!
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Wed Feb 27, 2008 10:38 pm Post subject: |
|
|
| 1qaz wrote: | i think u got me wrong :\
i ment i want to get my application's location into a string.. how can i do that?  |
System.IO.Directory.GetCurrentDirectory
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Feb 28, 2008 9:13 am Post subject: |
|
|
i got it working thx :]
_________________
Stylo |
|
| Back to top |
|
 |
|