3
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by Netcode
0

Here's a really simple example to save/load a text box's text:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' Save a text box's text
    Dim FileName As String = "C:\test.txt"

    My.Computer.FileSystem.WriteAllText(FileName, TextBox1.Text, False)

  End Sub

  Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
    ' Load a text box's text
    Dim FileName As String = "C:\test.txt"

    TextBox1.Text = My.Computer.FileSystem.ReadAllText(FileName)

  End Sub

If you want to save/load more than one text box, you can concatenate text's as a single string with a proper separator character, or take a look what System.IO namespace has to offer.

HTH

0

to save the contents of a text box:
it depends if you are saving to a file or to a DBMS
for a DBMS like sql server, just get your connection strings right, then use this
textbox1.databingds(text, datasource, connectionstring)

try it yourself but if you cant then i'll send you a complete code

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.