Calling Events

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hi,

I have a vb form with a list view control. The list view is populated in the
form_load event. When user clicks on an item in the list, it fires the
listview_click event, which populates text fields on the form with listitem
attributes.

The only problem is, I want to make the first item in the list selected by
default after loading and populate the text fields.

In my previous vb6 days, I would have done something like this:

If ListView1.ListItems.Count >0 Then
ListView1.ListItems(1).Selected = True
Call ListView1_ItemClick()
End if

Of course, now in .net world, there are arguments to the Click event
handler - what do I supply as values to that event from the form_load event?

Thank you

James
 
If listBox1.TopIndex <> listBox1.SelectedIndex Then
' Make the currently selected item the top item in the ListBox.
listBox1.TopIndex = listBox1.SelectedIndex
End If
 
Back
Top