List Boxes
-
Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah
-
Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah
Check out the SaveSetting and GetSetting functions. ___________ Klaus [www.vbbox.com]
-
Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah
During the form's Load() procedure you would Open the file for Input, Clear() the list box, then simply call Input # on the file to get a line and AddItem() to get it into the list, for each line. If you're wondering how to know how many items there are, you should write out the number of strings (using the list box's ListCount property) to the file as the first line. Then, when you read it back in, the first thing you read is the number of lines remaining in the file to add to the list box... Does that answer your question?
-
Hi everyone, i am newbie to Visual Basic. I have visual basic 6. My questions is that when a string is added to a listbox, how does the user see that information the next time the program is loaded. I know that the info has to be saved into a text file which i know how to do but i don't know how to read the info from the file and display it into the listbox. Thanks in advance ! Warm regards, Sarah
hi, try this when you type a new string and submit write the new string into a file dim F as long f=Freefile 'to get a valid file pointer 'open and add string to existing file open "c:\tmp.txt" for append as f print #f,combo1.text close f on form load, dim F as long dim mStr as string f=Freefile open "c:\tmp.txt" for input as f do while not eof(f) line input #f, mStr combo1.additem mstr loop close f