How to select a listbox item on right mouse click?

  • Thread starter Thread starter Pawan Singh
  • Start date Start date
P

Pawan Singh

Hi,

Is it possible to select a list box item when someone right clicks on
it? I can find the snippets of code for VB6 but that code will not
work in VB.Net.

Thanks
Pawan
 
Pawan Singh said:
Is it possible to select a list box item when someone right clicks on
it? I can find the snippets of code for VB6 but that code will not
work in VB.Net.

\\\
Private Sub ListBox1_MouseDown( _
ByVal sender As Object, _
ByVal e As MouseEventArgs _
) Handles ListBox1.MouseDown
Dim SourceControl As ListBox = DirectCast(sender, ListBox)
SourceControl.SelectedIndex = _
SourceControl.IndexFromPoint(e.X, e.Y)
End Sub
///
 
Back
Top