Visual Basic Save
•
26 May 2008, 08:20
•
Journals
For all the programmers in here, another question. I want my comboboxlist to be opened from a text file. My program also contains a function which has a textbox where you can write a text in, and then press a button "add" so it adds to the comboboxlist. Now I want the program to have a save button, so it will load any changed made in the past.
It should only load the folders with the text "Productiecontrole" in front of it, so it will be like "Productiecontrole Variable.
The savebutton is at Private Sub CommandButton5_Click()
Here's the code:
Thanks in advance!!!
It should only load the folders with the text "Productiecontrole" in front of it, so it will be like "Productiecontrole Variable.
The savebutton is at Private Sub CommandButton5_Click()
Here's the code:
Thanks in advance!!!
Read & write (save button) to the textfile and use its content to update the combobox.
Make some function and recall it to re-initialise (update) the combobox everytime some data in the txt/database file changed.
How can I export my current list to a textfile and load it next time again?
And in the Textfile I've added this:
Use breakpoints to stop the code and use F8 (or whatever your next step shortcut is) to loop through the code
sorry for asking so much questions, but this is all really new for me ^^
just make some c:\test.txt file and see how he handles that
Try this on form load:
Dim strInRec As String
Open "c:\test.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strInRec
ComboBox1.AddItem strInRec
Loop
Close #1
thx
I'm writing an archive system, because the current archiving sucks. I built a little screen for 1 section we call "productiecontrole", and I have a combobox with several products, all starting with the mapname "Productiecontrole". So it's like "Productiecontrole LSR", or "Productiecontrole Kunststoffen", etc... Now I need those in a textfile, and that it automatically loads that textfile to the program itself everytime I start it. Also I want a save button, if I add something to the list, so it loads that new thing in the list again next time (added and add function). So basically I just need a save function, it's a bit hard to explain but I guess u know what I mean ^^
Private Sub Form_Load()
uwtxt = "c:\test.txt"
Open uwtxt For Input As #1
While Not EOF(1)
Line Input #1, temp
Combobox1.AddItem temp
Wend
Close #1
End Sub
// SAVE FUNCTION BIJ FORM UNLOAD **
// Waardes van combo schrijven naar .txt
Private Sub Form_Unload(Cancel As Integer)
Open uwtxt For Output As #1
Dim x As Integer
For x = 0 To Combobox1.ListCount
Print #1, Combobox1.List(x)
Next x
Close #1
End Sub
Open uwtxt For Input/Output As #1
by
Open uwtxt For Binary Access Write Lock Read Write As #1
Or you can write some better check using FILE_NOTIFY_FLAGS but that's a bit too advanced for a VB6 beginner like spree
Kinda weird, coz it just works. Also, I don't see anything wrong with this line, maybe you know?