|
-
Mar 11th, 2001, 10:44 PM
#1
Thread Starter
Lively Member
If I build a list into a combo box and create a method of adding to that list. Can the list be modified after compiling?
-
Mar 11th, 2001, 10:51 PM
#2
Code:
Private Sub Command1_Click()
Combo1.AddItem Text1.Text
End Sub
you can make Text1 equal to whatever you want, and and it to your list. Is this what you mean?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 10:53 PM
#3
PowerPoster
I believe Crypt answered your question. Just be sure to set the combo box's style to "0"
-
Mar 11th, 2001, 10:56 PM
#4
Thread Starter
Lively Member
YES!
So even after compiling I can permanently add things to the list dynamically?
-
Mar 11th, 2001, 10:58 PM
#5
well, not permanently, just for that run of your app, you would have to generate a file that saves your list contents, and then, open the file and load the list when you start the program...
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 11th, 2001, 10:59 PM
#6
Permanently - no. If you want to have a list of items that is not hard-coded, you must either store and retreive them from a database or a file or some other data storage method.
-
Mar 11th, 2001, 11:05 PM
#7
PowerPoster
Here's something I just quickly wrote up
Code:
Option Explicit
Private Sub Command1_Click()
Combo1.AddItem Combo1.Text
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim x As Integer
Open "C:\Test.txt" For Output As #1
For x = 0 To Combo1.ListCount - 1
Print #1, Combo1.List(x)
Next
Close #1
End Sub
Private Sub Form_Load()
Dim x As Integer
Dim strCombo As String
Open "C:\Test.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strCombo
Combo1.AddItem strCombo
Loop
Close #1
End Sub
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
|