Need help saving info in text boxes please

Posts 1–11 of 11 · Page 1 of 1
Need help saving info in text boxes please
hi every one im making a maplestory account creator for my first time and i need help with some code please.



Ok so i want to be able to save what ever any one puts into those two text boxes into a .txt file on the desktop.

if anyone could help that would be great thanks.
Quote Originally Posted by bayley60 View Post
hi every one im making a maplestory account creator for my first time and i need help with some code please.



Ok so i want to be able to save what ever any one puts into those two text boxes into a .txt file if anyone could help that would be great thanks.
Double click the Save Button and add the following code to it:

'Replace Username.text and password.text with your respective textboxes !!
Code:
SaveSetting(Application.productname,"Settings","Username",Username.text)
SaveSetting(Application.productname,"Settings","Password",Password.text)

Then double click your form and add the following code:

Code:
Username.text=getsetting(Application.productname,"Settings","Username",Username.text)
Password.text=getsetting(Application.productname,"Settings","Username",password.text)
This will save the username and password, so it will autofill it when the form starts. Hope this helps !!
Ok i figured out what you meant but this is not quite what i want i want it to open a save option and save it to desktop or somewhere??

Plz help.
Quote Originally Posted by bayley60 View Post
thanks but what do u quite me by "Replace Username.text and password.text with your respective textboxes"

Ok i figured out what you meant but this is not quite what i want i want it to open a save option and save it to desktop or somewhere??

Plz help.
Facepalm. The username textbox and the password textbox you using on the form.
Quote Originally Posted by bayley60 View Post
Ok i figured out what you meant but this is not quite what i want i want it to open a save option and save it to desktop or somewhere??

Plz help.
SafeFileDialog???
[php]

Dim path As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\Settings.txt"

Using sr As IO.StreamWriter = New IO.StreamWriter(path)

sr.WriteLine(TextBox1.Text)
sr.WriteLine(TextBox2.Text)

End Using
[/php]

That what you want?
he means .. name the 2 textbox's TextBox1.Text instead of Username.Text
i need something like a savefiledialog??

any one no the code plz??
Code:
Dim rtb As New RichTextBox
        Dim path As String

        rtb.Text = Textbox1.text & vbNewLine & textbox2.text


  Using sfd As New SaveFileDialog

            sfd.Filter = "Rich Text Files (*.rtf)|*.rtf|Text File (*txt)|*.txt|All Files|*.*"

            If sfd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                path = sfd.FileName

                Using sw As New IO.StreamWriter(path)
                    sw.Write(rtb.Text)
                End Using

            End If

        End Using


The rtb.SaveFile didn't work for me somehow so I coded it somehow else
didnt work would this code work??

Code:
Dim Save As New SaveFileDialog() 
Dim myStreamWriter As System.IO.StreamWriter 
Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*" 
Save.CheckPathExists = True 
Save.Title = "Save File" 
Save.ShowDialog(Me) 
Try 
myStreamWriter = System.IO.File.AppendText(Save.FileName) 
myStreamWriter.Write(RichTextBox1.Text) 
myStreamWriter.Flush() 
Catch ex As Exception 
End Try
What didn't work?

My code did work for me...

"Your" code is basically the same lol.
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us