Of course you may not know what's in the listbox, in which case this will work, provided that there is something in the list:
List1.ListIndex = 0
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
As the controls are loaded during the Form_Load process it's best to put that code at the end of the Form_Load, and to be sure use Me.Show after you populate the list and before you set the ListIndex
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Oooops, just re-read your post, you state List1.List(1), not an array listbox as I misread. Your code List1.ListIndex = 0 should work, however try putting the form name in front see if makes any difference. The other thing, might be wrong and get more egg on my face, but the syntax List1.List(1), where (1) I think refers to a listindex value. If so and if thats what you want to start up with then I would have thought Form1.List1.Listindex=1 would have been what you wanted. Oh well, dug my hole now, move backwards slowly.
If you use the Form_Activate event it will fire every time the form regains focus from within the app, which may not be what is required.
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.