473,386 Members | 1,795 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,386 software developers and data experts.

How to text file items in a listbox

lee123
556 512MB
i have been working on a database and i was hoping someone out there can tell me how i can list the things in a listbox to text file in notepad i have tried everything i know but i still cant do it? i have used

Expand|Select|Wrap|Line Numbers
  1. Dim ff As String
  2.     ff = FreeFile
  3.     Me.Refresh
  4.     Open "C:\AutoMaintenance.log" For Append As #ff
  5.         Print #ff, "Vehicles Owns" & "    " & VehicleList
  6.     Close #ff
but still nothing is there a way to do this please help!!

lee123
Feb 10 '12 #1
10 2572
Mihail
759 512MB
Can you print the same thing in Immediate window ?
In the other words, are you very very sure that is there something to append to external file ?
Feb 10 '12 #2
lee123
556 512MB
well when i do it, it says "bad file name" but there is some thing in the listbox. so why doesnt it print. i mean if there is something in the listbox it should print right?
Feb 10 '12 #3
Mihail
759 512MB
ff is NOT a string because FreeFile return a numeric value.
I don't know exactly if it is an integer or a long.
So remove As String from DIM statement in order to dimension ff as a variant (the default dimension if you don't specify any dimension).

Let me know if steel not work and I'll take a closer look in order to help you.
Feb 10 '12 #4
lee123
556 512MB
well i have tried that and others but nothing? on my form i have textboxes and they seem to show up but its just the information in the listbox dont so thats why i used the "STRING" function, i guess there isnt a way to do that

lee123
Feb 10 '12 #5
NeoPa
32,556 Expert Mod 16PB
@Lee.
I'm not sure why you're still posting questions with most of the information missing after over 500 posts.

What's going wrong and where?
What's the value of [VehicleList] at the time line #5 is executed?

So much time and effort wasted for the want of a few minutes preparation on your part.
Feb 10 '12 #6
lee123
556 512MB
hmm.. Neopa, what's going wrong is that it shows nothing when it is executed everything else shows up but the items in the listbox. the line comes out blank. when you do the textboxes that are on the form the information shows up. but the way i was shown it doesnt work (the listbox information not the textboxes) all i wanted to know is how do you get the information from the listbox to print in notepad. the information i want to show is. (year, make, model,engine) because that is whats in the listbox but nothing.but if its "so much time and effort wasted then i am sorry for posting such a question" ill find someone else to answer the question somehow. because i thought i did explain it good in the first post, but i guess i didnt.

lee123
Feb 11 '12 #7
Mihail
759 512MB
This code will do your job (see attachment).
Of course you must adapt it to your needs.

Good luck !

PS
My ListBox is a MultiSelect one.
Attached Files
File Type: zip PrintInNotePad.zip (54.6 KB, 134 views)
Feb 11 '12 #8
lee123
556 512MB
Mihail, thanks for the file i will look at it.

lee123
Feb 11 '12 #9
NeoPa
32,556 Expert Mod 16PB
@Lee.
I found your response very difficult to make any sense of, as any punctuation, where it was used, was done so erroneously, and resulted in something quite indecipherable without even more effort. Only one of my questions even appears to have an attempted answer, so I'll leave you to other experts here, but please understand that, as a moderator, I won't just go away. All our experts deserve protection from such casually off-hand members, and please understand they will get it while I'm around.
Feb 11 '12 #10
lee123
556 512MB
Mihail, Thank you for your help. It works just like a charm.

@Neopa, sorry for not punctuating my words but you are an educated man i see, as for me not so much. I Know you meant well and i appriciate it. I know your just doing your job sorry next time ill put my questions in the right form.

lee123
Feb 12 '12 #11

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

Similar topics

1
by: wayne | last post by:
hi, how can i load a text file into a list box, so that when i run th program, the list box will have a list of items in it? thank - wayn
2
by: Tom McL. | last post by:
I would like to align text in a ListBox to achieve columns. In the past I could determine the text width in Twips and pad in required number of blank spaces. But now I'm using VB2005 and it...
1
by: jshaulis06 | last post by:
ok, heres my problem. im trying to make a program that searches a text file with a key word created by the user and prints it in a list box. sorta like a dictionay program in vb.net heres what i...
5
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
6
by: kimiraikkonen | last post by:
Hi, I want to save all the item content of a listbox line by line into a simple text file then recall them when my project is opened. For example listbox1 contains: That - item1 Group ...
6
by: kimiraikkonen | last post by:
Hi, I can read from a text file and insert text file's contents into a listbox whose format is line by line using this code: Dim reader As String reader = My.Computer.FileSystem.ReadAllText("c:...
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(); ...
4
by: mikkoO8 | last post by:
hi. im actually making a desktop cleaner that can move the files and icons to a folder inside the listview box. i can make the listview box filled with files contains at the desktop and i can make...
21
Mas Juliza Alias
by: Mas Juliza Alias | last post by:
Hi, I am building a program on Information System for Reservoir Operation for my Masters research. Now I have a text file which is an output file from a processing software (Terramodel) that lists...
3
by: Stacey Prahl | last post by:
Option Strict On Public Class frmBookPublishing ' Class Level Private Variables Private Shared _intSizeOfArray As Integer = 16 Private Shared _strWarehouseItem(_intSizeOfArray) As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.