How can I GoToRecord in a List box?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to have a vb code that will autimatically set the focus on a
list box in column 0 and go to the first record that is blank (is null) and
select it? if so, could someone provide me an example of the code...
 
in order to "goto" (actually it is called select) in list box - set it to a
value of bound column, which one you want to have selected

also you can go through all items, see column property and selected property
in online help
 
Is there a way to have a vb code that will autimatically set the focus
on a list box in column 0 and go to the first record that is blank (is
null) and select it? if so, could someone provide me an example of the
code...

if columns(0) is the bound column, then you can just iterate the
ItemData collection to find the first non-blank value; otherwise you can
look through the Column(column, row) array to find it.

' r is the row counter
For r = 1 to lisMyList.ListCount-1
If Len(lisMyList.Column(0,r))>0 Then
' found it
lisMyList.Selected(4)=True
Exit For

End If
Next r

' check for all blank
If r = lisMyList.ListCount Then
lisMyList.Enabled = False

End If

or something like that

Hope it helps


Tim F
 
Back
Top