|
-
Mar 9th, 2003, 06:58 PM
#1
Thread Starter
New Member
Retrieving / storing data into seperate labels
I have text file that needs to listed store data as follows:
cat,black,1
dog,brown,2
When retriving the data I need the information to look as follows in a list box:
Cat (Black) 1
Dog (Brown) 2
Is this possible? In addition, I need to store user entered data from three textboxs into the same .txt file in the the following
manner:
cat,black,1
dog,brown,2
Can any one help me.... I think I'm going insane 
Thks in advance for yr help.
-
Mar 9th, 2003, 07:05 PM
#2
New Member
Private Sub Form1_Load()
On error resume next
Open "c:\dogs.txt" for output as #1
Print #1, "cat,black,1"
Print #1, "dog,brown,2"
Close #1
Open "c:\dogs.txt" for input as #1
Do While Not EOF(1)
Line Input #1, variable
List1.AddItem Split(variable,",")(0) + " (" + Split(variable,",")(1) + ") " + Split(variable,",")(2)
DoEvents
Loop
Exit Sub
End Sub
Requirements:
Control Listbox named List1
Form named Form1
Just slap that in your VB Form Code and it should work!
GL.
-
Mar 9th, 2003, 07:34 PM
#3
Thread Starter
New Member
... works a treat. Just one more quick question to make the the list box a little easier to read, is it possible to inser either a black or a "-" between each item?
Cat - Brown - 1
or
Cat Brown 1
Tks for yr help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|