Is there a way to highlight an item in a VB.Net listbox without allowing the user to change selection?
When I set the selection Mode to "NONE" I can´t select an item in the code. Same when I disable the listbox.
Is there a way to highlight an item in a VB.Net listbox without allowing the user to change selection?
When I set the selection Mode to "NONE" I can´t select an item in the code. Same when I disable the listbox.
Setting the list box' Enabled property to False works fine:
Public Class Form1
Public Sub New()
InitializeComponent()
ListBox1.Items.AddRange(New String() {"one", "two", "three"})
ListBox1.Enabled = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.SelectedIndex = 1
End Sub
End Class