I always wanna mark the first item in my listbox when I start the form. How do I do that?
VB Code: Private Sub Form_Load() List1.ListIndex = 0 End Sub
Private Sub Form_Load() List1.ListIndex = 0 End Sub
Code: If Question = Incomplete Then AnswerNextOne Else ReplyIfKnown End If cu Swatty
If Question = Incomplete Then AnswerNextOne Else ReplyIfKnown End If
VB Code: Private Sub Form_Load() If List1.ListCount > 0 Then List1.ListIndex = 0 End If End Sub
Private Sub Form_Load() If List1.ListCount > 0 Then List1.ListIndex = 0 End If End Sub
Build solutions from Windows Explorer
List1.Selected(0) = True
If I use List1.Selected(0) = True, the first item selected. But I still must click on the listbox to get the value to my code? Why?
...because I don't think it fires off any events... Woka
My .NET Tutorials: • Silverlight Enabled WebPart in WSS My VB.NET Code Examples: • Create IIS Virtual Directory • Validate Login Against Active Directory • Automatically retrieve Identity field value from inserted DataRow using SQL Server and ADO.NET My ASP.NET Code Examples: • Login To Website (Forms Authentication) • Login To Website (Custom Authentication) My VB6 Code Projects: • Multithreading In VB6 • Custom Tooltips • Multi Language Support • Item Selector Control • Annimated Systray Icon • Simple Effective Graph Control • Download From Web • LiveUpdate, download application updates from the web automatically • Systray Notification Messages • Skin A Form • API Timer • Badger Messenger, an MSN clone that uses the MSN Network • Wokawidgets VB6 Component Suite
Call the click event of the list after you set the selected item VB Code: List1_Click
List1_Click
...or use Axion's or Swatty's code Woka
which control are you using ?? VB Code: Private Sub Form_Load() List1.AddItem "hoera" List1.Selected(0) = True End Sub Private Sub List1_Click() MsgBox "clicked" End Sub Worked for me without calling the click event.
Private Sub Form_Load() List1.AddItem "hoera" List1.Selected(0) = True End Sub Private Sub List1_Click() MsgBox "clicked" End Sub
Forum Rules