8 replies
by sl-campbell
As opposed to the MS Access DBCombo, the combo box delivered with VB6 does not automatically fill a list with more than one field. You have to do this manually.
What I do is get the fields from the recordset that I want to show in the combo and assign them to a variable. To do this you need to create a loop on the recordset in order to get the fields for all records:
Combo1.Clear
Do Until rsData.EOF
sListFld1 = rsData("myFirstField")
sListFld2 = rsData(("mySecondField")
Combo1.AddItem sListFld1 & vbTab & vbTab & sListFld2
rsData.MoveNext
Loop
However, you are dependent upon the vbTab to display "two" columns - you may have to change the Tab settings if it is too short or long (I believe 4 spaces in VB is default). You may just want to leave the default and add another vbTab.
Another way would be to use a list box in conjunction with a combo box - you can do more with a the values in a list box. When the user clicks on the combo, it doesn't open up butinstead the list box becomes visible. The combo box gets then updated based upon the selection in the listbox.
But the first way is the simplest and fastest way.
by sl-campbell
by sl-campbell
by sl-campbell
You can also use the Microsoft Forms 2.0 in your project. You are not allowed to distribute it but I have found that most systems have it already, and it not, then the client can get the dll by loading IE 3+
Can this be closed now?
by mjenkins
by sl-campbell
by mjenkins
by mjenkins
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending