|
-
Aug 14th, 2007, 07:18 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Req: Combo box info
Can someone tell me please if I add a combo box to a blank fresh application, how do I add data to the combo box, so when I run it, and press the drop down there are e.g. 5 keywords in there?
Thank you.
-
Aug 14th, 2007, 07:25 AM
#2
Re: Req: Combo box info
Where is the data that will be in the combo being stored?
-
Aug 14th, 2007, 07:35 AM
#3
Re: Req: Combo box info
 Originally Posted by jokerfool
Can someone tell me please if I add a combo box to a blank fresh application, how do I add data to the combo box, so when I run it, and press the drop down there are e.g. 5 keywords in there?
Thank you.
Like this:
vb Code:
With Combo1
.AddItem "Keyword 1"
.AddItem "Keyword 2"
.AddItem "Keyword 3"
.AddItem "Keyword 4"
.AddItem "Keyword 5"
End with
Let me know if you will be loading your data from a database and I will show you how to do it.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Aug 14th, 2007, 07:37 AM
#4
Thread Starter
Hyperactive Member
Re: Req: Combo box info
Okay I am not so hot at using this vb6, but I was hoping that data was just stored in the form, I say this because I have another form that contains hundreds of websites and all the websites are listed in the form, so was just wanting the same thing.
-
Aug 14th, 2007, 07:40 AM
#5
Thread Starter
Hyperactive Member
Re: Req: Combo box info
hmmmm so I place the combo box down, double click it and do I just add the above like this:
Code:
Private Sub Combo1_Change(Index As Integer)
With Combo1
.AddItem "Keyword 1"
.AddItem "Keyword 2"
.AddItem "Keyword 3"
.AddItem "Keyword 4"
.AddItem "Keyword 5"
End With
End Sub
-
Aug 14th, 2007, 07:46 AM
#6
Re: Req: Combo box info
 Originally Posted by jokerfool
. . . I have another form that contains hundreds of websites and all the websites are listed in the form, so was just wanting the same thing.
How are you "storing" the data on the other form? Could you post your project? Exactly, what data are you looking to "store" in the combobox?
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Aug 14th, 2007, 07:52 AM
#7
Thread Starter
Hyperactive Member
Re: Req: Combo box info
the data in the combo box will only be keywords and random keywords e.g.
dog
cat
fish
lion
wolf
-
Aug 14th, 2007, 07:58 AM
#8
Re: Req: Combo box info
"Storing" the keywords in the form means hard coding them.
If you ever want to change them or add to them you would need to modify the source code, recompile the program, and redistribute it.
-
Aug 14th, 2007, 08:02 AM
#9
Thread Starter
Hyperactive Member
Re: Req: Combo box info
Yes I understand this and I know its the hard way but I dont know any other way of doing it, not without someone teaching me how to do this.
Ive scoured the forum and googled all sorts of answers and comeup with this from creating a combo box ( drop down ) combo1 and combo2:
Code:
Private Sub Form_Load()
Combo1.AddItem "dog"
Combo1.AddItem "cat"
Combo1.AddItem "fish"
Combo1.AddItem "people"
Combo1.AddItem "humans"
Combo1.AddItem "plants"
Combo2.AddItem "12345"
Combo2.AddItem "hello"
Combo2.AddItem "abcde"
Combo2.AddItem "counting"
Combo2.AddItem "websites"
Combo2.AddItem "frog"
End Sub
Yes this is the hard way but I know of no other way.
-
Aug 14th, 2007, 08:06 AM
#10
Re: Req: Combo box info
Use a database. They can be dynamically updated without changing any of your code.
We have a ton of database examples in our FAQ section as well as database tutorials.
-
Aug 14th, 2007, 08:12 AM
#11
Thread Starter
Hyperactive Member
Re: Req: Combo box info
Okay will do, thank you for the assistance. One last question in a new thread, thank you.
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
|