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!

listbox first line selected 1

Status
Not open for further replies.

andyukcy

Technical User
Jul 9, 2003
64
0
0
Hello ...

I have a list box in a form and I want the First line to be always selected automatically.
How can i do that?

Thanks
 
Always?
I suspect not, otherwise there would be no point to the list box:)-)

To select the first item when you move to a different record you could do:

Me.MylistControl = Me.MylistControl.itemdata(0)



 
Thank You very much, That is exectly what I wanted
A star from me
 
Thanks this answered a problem I have been having I was trying to use this to set the selection in another listbox on the selection of a value in the first listbox
Code:
LOrders.Requery
If LOrders.ListCount > 0 Then
   LOrders.Selected(0) = True
Else
    ORDERID = Null
End If
and it was failing to allow me to select the second list box

I changed
Code:
LOrders.Selected(0) = True

to this 

LOrders = LOrders.ItemData(0)
and it worked fine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top