Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box - showing a default value

Status
Not open for further replies.

lminmei

Programmer
Feb 1, 2000
111
US
I want to create a combo box in visual basic that shows the first value in a list as the default selected value

how do i do this? please help [sig][/sig]
 
What-ho!

try this:

Me.Combo1.Text = Me.Combo1.List(0)

Make sure the ComboBox list is populated first :)


Cheerio,

Paul
[sig][/sig]
 
Or you could use

combo1.listindex=0

(but like the previous method, check that the list is populated - if combo1.listcount>0 then ...)

Simon [sig][/sig]
 
What if what I want to set it to isn't necessarily the first row in the list (0)... I want my dynamically filled list to point to a specific item, the one that is used to most often.

(Thanks in advance!) ****************
DariceLR
:-{} :-V
****************
 
Then you'll have to determine which list item is used most often. After that, you can move that item to the top (0), or hard code its position in the list when you set its ListIndex. Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
If I move the name of a DSN, will the DSN still be attached??? I am using the Wizard made ODBC Logon, and my app uses a specifically name DSN

How would I move that up? ****************
DariceLR
:-{} :-V
****************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top