2 Attachment(s)
Un-highlist listbox when not enabled?
I created a form with a listbox. It always loads with the default text selected.
The problem is, I disabled the listbox until the user completes a previous step, yet the selection highlight remains (with unseen text.) I don't want a highlight until after the user selects an item.
Is there a way to hide the selection until the object is enabled and a selection is made? TIA
What I'm getting:
Attachment 184581
What I want:
Attachment 184583
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ListBox1.SelectedIndex = 0 ' This value will change in finished code.
End Sub
End Class
(ListBox1 contains 4 items and is Disabled by default. Changing it to Enabled by default shows the text but I don't want the listbox enabled or the selection visible until the previous step is completed.)
Re: Un-highlist listbox when not enabled?
Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Select
ListBox1.SelectedIndex = -1 ' No item selected
End Sub
End Class
Re: Un-highlist listbox when not enabled?
You can set SelectedIndex to 0. It’s setting the ActiveControl to a Label that should solve your problem…
Re: Un-highlist listbox when not enabled?
My apologies for not replying. Your reply got caught in spam filter.