ComboBox issue

crvasquez

Active member
Joined
Mar 3, 2008
Messages
40
Location
Florida
Programming Experience
10+
Hope someone can help. I've attached a picture to provide a visual of what I am having an issue with. There is a "frequency" combobox and a "day" text box. What I am trying to do is set day.enable = false or day.enable = true depending on the value of the combobox. So, if "Frequency" = "Monthly" then day.enabled = "false" otherwise day.enabled = "true".
 

Attachments

  • ComboBox.JPG
    ComboBox.JPG
    7.4 KB · Views: 53
The problem is that the below code does not fire until you click in the Plan Hours textbox. If I click in the day textbox it does not fire. I placed the code in cboFrequency_SelectedIndexChanged and cboFrequency_TextChanged. I need it to fire when I select the value on the combobox.

Thx

VB.NET:
    Protected Sub cboFrequency_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) 
                      Handles cboFrequency.SelectedIndexChanged

        If Me.cboFrequency.Text = "Monthly" Then
            Me.txtDay.Text = ""
            Me.txtDay.Enabled = False
            Me.txtDay.BackColor = Drawing.Color.Gray
            Me.txtPlanHrs.Focus()
        Else
            Me.txtDay.Enabled = True
            Me.txtDay.BackColor = Drawing.Color.White
            Me.txtDay.Focus()
        End If

    End Sub
 
You might want to provide your code (attach to this thread) because there is no reason that should fire when you click in a text box but not when you select an item from the list.
 
Back
Top