473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Save listbox contents to text file

I am trying to take the values in a listbox and save them to a txt file. So far I am getting nowhere.
Aug 25 '07 #1
5 6151
Sorry, I guess I was in a hurry, the subject should say Listbox as well.
Aug 25 '07 #2
QVeen72
1,445 Expert 1GB
Sorry, I guess I was in a hurry, the subject should say Listbox as well.
Hi,
Check this code:

Expand|Select|Wrap|Line Numbers
  1. Dim FN As Long
  2. Dim i As Integer
  3. FN = FreeFile
  4. Open "C:\MyText.txt" For Output As FN
  5. For i = 0 To List1.ListCount -1
  6.   Print #FN, List1.List(i)
  7. Next
  8. Close #FN
  9.  
  10. Msgbox "Check File C:\MyText.txt"
Regards
Veena
Aug 26 '07 #3
Killer42
8,435 Expert 8TB
Sorry, I guess I was in a hurry, the subject should say Listbox as well.
Gee, the title looks alright to me... ;)
Aug 27 '07 #4
Hi,
Check this code:

Expand|Select|Wrap|Line Numbers
  1. Dim FN As Long
  2. Dim i As Integer
  3. FN = FreeFile
  4. Open "C:\MyText.txt" For Output As FN
  5. For i = 0 To List1.ListCount -1
  6.   Print #FN, List1.List(i)
  7. Next
  8. Close #FN
  9.  
  10. Msgbox "Check File C:\MyText.txt"
Regards
Veena
Thanks Veena, that works perfect
Aug 30 '07 #5
Gee, the title looks alright to me... ;)
Just saying 'Nicely Done' isn't possible because it was less then 20 characters, So I am going to ramble a bit.. ...Nicely Done
Aug 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
2
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System;...
2
by: Drunkalot | last post by:
I wrote a program that made some combinations and add them to a listbox, and i need to save the contents of the listbox every 1 minute... The method that save the content of the listbox i have...
2
by: Joe Fallon | last post by:
I need to save the contents of a listbox in a serializable object. I not only need the values but the index positions as well. For example, a listbox with 3 entries may look like this: Index ...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
1
by: JNariss | last post by:
Hello, I have created a form called frmS2P with the following: 1 listbox called List11 which holds the contents of a query created off my table called tblRequestActions. The fields which the...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
9
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback)....
1
by: papafreebird | last post by:
I would like to save the contents of a wxListBox to a text file. Using borland c++ builder I am able to accomplish this by using the following code ListBox1->Items->GetText(); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.