|
-
Jun 4th, 2009, 10:13 AM
#1
Thread Starter
New Member
-
Jun 4th, 2009, 10:17 AM
#2
Re: Saving as .bat...
Lets say your notepad app has a textbox where the user types the text and it is called textbox1.
You can use code like this to save the text from that textbox to a file
Code:
Dim myFileName As String = "C:\somefile.bat"
My.Computer.FileSystem.WriteAllText(myFileName, textbox1.text, False)
of course this means the file will be "C:\somefile.bat" everytime since it is hard coded. What you likely want to do, is make use of the "SaveFileDialog" component in the toolbox, so you could bring up a save dialog and have the user select the path and name the file whatever they want. You would then use that filename instead of the hard coded one to save the text to a bat file.
-
Jun 4th, 2009, 01:08 PM
#3
Re: Saving as .bat...
Add a batch thing to your SaveFileDialog.
vb Code:
o_dl.Filter = "Text Document (*.txt)|*.txt|Batch File (*.bat)|*.bat|All Files (*.*)|*.*"
-
Jun 4th, 2009, 03:23 PM
#4
Thread Starter
New Member
-
Jun 4th, 2009, 03:24 PM
#5
Thread Starter
New Member
Re: Saving as .bat...
Thanks for the answer, but I just wanted it to be saved as a .bat without any more actions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|