[RESOLVED] Textbox Saveing [Easy Question]
Hi all I need help with textbox saveing.
first the text
I'm making something like registering your self to something.
like
Name:[ Here the textbox]
Age:[ Here text box]
Register Button
If I click on the register button it should make a textfile with the information innit that works fine but I also want that the text "Name:" and "Age" commes infront of the data in the textfile what I'm now getting is only the data i want it like this in the textfile
Name: VBforums
Age: 99
This is my code I cant figure out how to do that
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sWriter As New System.IO.StreamWriter("C:\vbforums.txt", True)
sWriter.WriteLine(TextBox2.Text)
sWriter.WriteLine(TextBox1.Text)
sWriter.Close()
End Sub
Thx already !!!
~ NitroAfg:wave:
Re: Textbox Saveing [Easy Question]
Code:
Dim sWriter As New System.IO.StreamWriter("C:\vbforums.txt", True)
sWriter.WriteLine("Name: " & TextBox2.Text)
sWriter.WriteLine("Age: " & TextBox1.Text)
sWriter.Close()
Assuming textbox1 is your age box, and textbox2 is your name box, this will write out the values from them to the textfile, with the string literals of "Name: " and "Age: " before them (note the space after the : to make the text file easier to read)
Re: Textbox Saveing [Easy Question]
Thx dude it worked nice :)
BTW can I send the textbox to my e-mail. When clickin on the Register button.
Sorry for my bad english ..
Thx !!:thumb: :thumb:
Re: [RESOLVED] Textbox Saveing [Easy Question]
yes you can, but it would require the user or you provide SMTP information that will work for their machine to send email. This usually does not work well, as it is not very compatible or you get people who do not know what settings should be used, or you need different ports configured for various ISP
What I actually do is I made a webservice on my website, and I send the data I want to email to the webservice. The webservice then emails the data to me from my website. This works better. Not sure if that is an option for you though.
Re: [RESOLVED] Textbox Saveing [Easy Question]
Quote:
Originally Posted by kleinma
yes you can, but it would require the user or you provide SMTP information that will work for their machine to send email. This usually does not work well, as it is not very compatible or you get people who do not know what settings should be used, or you need different ports configured for various ISP
What I actually do is I made a webservice on my website, and I send the data I want to email to the webservice. The webservice then emails the data to me from my website. This works better. Not sure if that is an option for you though.
Thx thats a great ID :D
I'm using hotmail WLM MSN :P
but I'm not looking for the idea of yours
I want that the program sends the textfile to my e-mail :P
thanx dough