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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting datacombo selecteditem

Status
Not open for further replies.

judyscofield

Programmer
Sep 24, 2001
56
0
0
US
I have a datacombo box on a form called dacrules. When stepping through my code, I can see the .selecteditem property. For example it may show 2. I want to set it to, say, 3. When I code
dacrules.selecteditem = 3
I get an error, Object Required.

What's wrong with my code??

Thanks

Judy Scofield
 
Hi Judy,
When you say, "Data Combobox", I hope you're talking about a normal ComboBox. A combobox control has a property (that also acts as a method) called listindex. You may set the listindex of a combobox with the code: ComboBox1.Listindex = 4. This code would display the 5th item in that combobox (as the items start at 0). You may use it as a property with the code: Variable = ComboxBox1.ListIndex.

I hope this solves your problem...

-Jason
 
Jason,

Thanks - actually it i a data combo box and I didnt' see a listindex property. Is it the same on this control?

Judy
 
I'm not sure, I've never encountered a data combo box; is it a normal control or a custom control?

- Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top