I have 7 textbox entries and I would like to add them to a listbox and when I close my application it would save them, I have the code for the 7 texboxes and everything like that has been done, but I just dont know how to add multiple textboxs to a listbox then save the list box so when I close the application and reopen it, itll still be there, could someone help me out. I know I need a button to add the list to the listbox, but how do I save them, so theyll still be there?
twigan1015
0
Newbie Poster
Recommended Answers
Jump to PostHi,
Here's an example how to save the listboxitems to a textfile:
Private Shared Sub WriteToFile() Dim SW As StreamWriter SW = File.Create("c:\MyTextFile.txt") For Each item As ListItem In ListBox.items SW.WriteLine(item.text) Next SW.Close() End Sub
Jump to PostAdding 7 nos. textbox's text into a listbox
lstAlbums.Items.Add(Form1.textbox1.text.ToString) lstAlbums.Items.Add(Form1.textbox2.text.ToString) lstAlbums.Items.Add(Form1.textbox3.text.ToString) lstAlbums.Items.Add(Form1.textbox4.text.ToString) lstAlbums.Items.Add(Form1.textbox5.text.ToString) lstAlbums.Items.Add(Form1.textbox6.text.ToString) lstAlbums.Items.Add(Form1.textbox7.text.ToString)
For saving a listbox item into a text file
'for saveing listitem into text file Dim Objfile As New System.IO.StreamWriter("C:\TestText.txt") Dim intCounter As Long For intCounter = 0 To …
All 7 Replies
Luc001
77
Posting Whiz
codeorder
197
Nearly a Posting Virtuoso
P.manidas
39
Posting Whiz in Training
Saikalyankumar
-2
Junior Poster in Training
twigan1015
0
Newbie Poster
P.manidas
39
Posting Whiz in Training
tdeath
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.