[RESOLVED] Saving textbox text to a file WITHOUT user clicking.
Hello,
Is there anyway for me to get my program to just save my textbox text to a txt file without the user having to enter a filename and click on save?
Example.
Right now I am using this code.
But as you can see it requires the user to enter a file name and click save.
My form has the commponent Microsoft Common Dialog Control (Named cdl)
a textbox (Named txtTest.txt)
and a command button
VB Code:
Private Sub Command1_Click()
cdl.Filter = "App File|*.smd"
cdl.InitDir = "C:\Test.Txt"
cdl.ShowSave
If Len(cdl.FileName) = 0 Then Exit Sub
Close
Open cdl.FileName For Binary As #1
Put #1, , txtTest.Text
Close #1
End Sub
Is there any way to change this so that it is auto save when the user clicks the command button. Also I would want the program to save the text to the txt file without deleteing what is already in the file. So it would just add it on in a new line.
Thank you all!
Stilekid007
Re: Saving textbox text to a file WITHOUT user clicking.
VB Code:
Open "C:\some filename that you cant change since you want to remove the common dialog.smd" For Append As #1
Print #1,txtTest.Text
Close #1
Re: Saving textbox text to a file WITHOUT user clicking.
Thanks man! That did it perfect!
Stilekid007