Hi I need a help in choosing a combo box event for placing this code. I have tried with Lostfocus,leave,mousefocuschanged,displaymemberchanged like this but nothing works and Lable26(Default I set Visible:false ) is visible even after I select an Item.

If combotype.SelectedIndex = -1 Then
            Label26.Visible = True
            Label26.ForeColor = Color.Red
            Label26.Text = "(Select the Job Category )"
        Else
            Label26.Visible = False
        End If

The below code will trap the event you are after. However, once an item is selected, it can't be deselected without selecting another value. In other words, SelectedIndex will never again = -1. It would seem that you need to set Label26.visible = true during load and then let this function turn it off after the user selects a value.

Private Sub ComboType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboType.SelectedIndexChanged
        If ComboType.SelectedIndex = -1 Then
            Label26.Visible = True
            Label26.ForeColor = Color.Red
            Label26.Text = "(Select the Job Category )"
        Else
            Label26.Visible = False
        End If
    End Sub
Comments
Good

thanks smith now the code works fine but I placed the code in lostfocus event

Be aware that lost focus also fires when the app looses focus, not just when the control looses it. So, if the combobox has focus and they switch apps to read an incoming email, this event will fire.

Be aware that lost focus also fires when the app looses focus, not just when the control looses it. So, if the combobox has focus and they switch apps to read an incoming email, this event will fire.

Yes its true, but when i place the code in Selectedindexchanged event means nothing happens when I leave the combo box.

This question has already been answered. Start a new discussion instead.