944,084 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 387
  • VB.NET RSS
Nov 1st, 2009
0

How to save ?

Expand Post »
Hi guys , how can i save some texts from textboxes into a word in a listbox so when i will reopen the program i will continue having the save?

Regards,
xVent.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
xVent is offline Offline
54 posts
since Dec 2008
Nov 2nd, 2009
0
Re: How to save ?
you can either save it in My.Settings or create a xml/text file to hole the data.
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009
Nov 3rd, 2009
0
Re: How to save ?
You need to save the values on an external file(Settings.txt)
Last edited by yorro; Nov 3rd, 2009 at 5:39 am.
Reputation Points: 8
Solved Threads: 7
Junior Poster
yorro is offline Offline
119 posts
since Aug 2009
Nov 3rd, 2009
-1
Re: How to save ?
the problem is that i dont know the way to do it.

-xVent
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
xVent is offline Offline
54 posts
since Dec 2008
Nov 4th, 2009
0
Re: How to save ?
just a small example:
vb Syntax (Toggle Plain Text)
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. My.Computer.FileSystem.WriteAllText("myText.txt", TextBox1.Text & "#", True)
  3. ListBox1.Items.Add(TextBox1.Text)
  4. TextBox1.Clear()
  5. End Sub
  6.  
  7. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  8. Try
  9. For Each line As String In My.Computer.FileSystem.ReadAllText("myText.txt").Split("#")
  10. ListBox1.Items.Add(line)
  11. Next
  12. Catch ex As system.IO.FileNotFoundException
  13. 'file doesnt exist yet
  14. End Try
  15. End Sub
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Loading user input into parralell arrays, Please help!
Next Thread in VB.NET Forum Timeline: Visual Basic Databases





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC