focus in listboxes

  • Thread starter Thread starter marco
  • Start date Start date
M

marco

Is it possible to set the focus to a particular record in
a list box? (so not to the box itself, but to an 'item' in
the box)

Thanks,


Marco van Haaften
 
Is it possible to set the focus to a particular record in
a list box? (so not to the box itself, but to an 'item' in
the box)

Sure, but that means actually setting the value of the listbox as in the
following examples (this assumes that the listbox's "Multiselect" property is
set to "None"):

If the bound column in the listbox is a number ...

Me.MyListBox.Value = 22

Or, if the bound column in the listbox is a string ...

Me.MyListBox.Value = "A35M7"

And, if you simply want to set the value to the first item in the list,
regardless of the value, you can use (automatically accommodates the listbox's
"ColumnHeads" property setting):

Me.MyListBox.Value = Me.MyListBox.ItemData(Abs(Me.MyListBox.ColumnHeads))
 
Back
Top