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

Select item in combobox with listindex? 1

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi,

im trying to select a specific item within a combobox using listindex on object init but the selected item does not change... it always stay to the first.

the command i used is:
Code:
thisform.comboboxObject.ListIndex = 6
 
any idea why it does not select the 6th item in combobox? Or if you know how to do it with indexes.

The RowSource of the combo box is a String like this "item1,item2,...,item6,item7
 
Have you set rowsourcetype to 1 (Value)?

This works for me:
Code:
_screen.addobject('combo','combobox')

With _screen.combo
  .rowsourcetype = 1 && Value
  .rowsource="i1,i2,i3"
  .listindex=2
  .visible = .t.
endwith

Bye, Olaf.
 
yes

Combobox.init
Code:
this.RowSourceType = 1
this.RowSource = strList
this.ListIndex = 6
 
maybe its something else later in program that reset the selected item... but i cant find why. I breaked trough all code line by line and i got no clue.
 
Found it there was a place with a hidden listindex=1
 
Well not really hidden
it was in a button event... about time the day end lol
 
If the list hasn't been fully populated yet, setting ListIndex to a value doesn't work. Try calling listbox.Requery() first.

Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top