ComboBox And Panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CollegeStud
    New Member
    • Dec 2020
    • 2

    ComboBox And Panel

    Hello, I am making an application where You will select a color from a combo box and after pressing select button it would show what "Inside Out" Movie character you are. The Characters are in 5 Different hidden panels.

    My problem is that it's showing this error:
    Error 2 Operator '=' is not defined for types 'System.Windows .Forms.ComboBox ' and 'Integer'

    How should I make this?
    Here's my Code
    Code:
    Public Class Form1
        Private Sub ColorListComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorListComboBox.SelectedIndexChanged
    
        End Sub
    
        Private Sub Selectbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Selectbtn.Click
            Select Case ColorListComboBox
                Case 0
                    Angerpnl.Visible = True
                Case 1
                    Joypnl.Visible = True
                Case 2
                    Joypnl.Visible = True
                Case 3
                    Sadnesspnl.Visible = True
                Case 4
                    Disgustpnl.Visible = True
                Case 5
                    Disgustpnl.Visible = True
                Case 6
                    Fearpnl.Visible = True
                Case 7
                    Fearpnl.Visible = True
                Case 8
                    Joypnl.Visible = True
                Case 9
                    Angerpnl.Visible = True
                Case 10
                    Angerpnl.Visible = True
                Case 11
                    Sadnesspnl.Visible = True
                Case 12
                    Disgustpnl.Visible = True
                Case 13
                    Fearpnl.Visible = True
                Case 14
                    Sadnesspnl.Visible = True
                Case Else
                    Errorlbl.Visible = True
            End Select
        End Sub
    
        Private Sub Exitbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exitbtn.Click
            End
        End Sub
    
    End Class
    Attach is a Scrrencap of my Design
    Attached Files
  • CollegeStud
    New Member
    • Dec 2020
    • 2

    #2
    Answer:
    Public Class Form1
    Private Sub ColorListComboB ox_SelectedInde xChanged(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ColorListComboB ox.SelectedInde xChanged

    End Sub

    Private Sub Selectbtn_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Selectbtn.Click
    Select Case ColorListComboB ox.SelectedInde x
    Case 0
    Angerpnl.Visibl e = True
    Case 1
    Joypnl.Visible = True
    Case 2
    Joypnl.Visible = True
    Case 3
    Sadnesspnl.Visi ble = True
    Case 4
    Disgustpnl.Visi ble = True
    Case 5
    Disgustpnl.Visi ble = True
    Case 6
    Fearpnl.Visible = True
    Case 7
    Fearpnl.Visible = True
    Case 8
    Joypnl.Visible = True
    Case 9
    Angerpnl.Visibl e = True
    Case 10
    Angerpnl.Visibl e = True
    Case 11
    Sadnesspnl.Visi ble = True
    Case 12
    Disgustpnl.Visi ble = True
    Case 13
    Fearpnl.Visible = True
    Case 14
    Sadnesspnl.Visi ble = True
    Case Else
    Errorlbl.Visibl e = True
    End Select
    End Sub

    Private Sub Exitbtn_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Exitbtn.Click
    End
    End Sub

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    ColorListComboB ox.Items.Add(" Red ")
    ColorListComboB ox.Items.Add(" Orange ")
    ColorListComboB ox.Items.Add(" Yellow ")
    ColorListComboB ox.Items.Add(" Blue ")
    ColorListComboB ox.Items.Add(" Green ")
    ColorListComboB ox.Items.Add(" Indigo ")
    ColorListComboB ox.Items.Add(" Purple ")
    ColorListComboB ox.Items.Add(" Turquoise ")
    ColorListComboB ox.Items.Add(" Pink ")
    ColorListComboB ox.Items.Add(" Brown ")
    ColorListComboB ox.Items.Add(" Gray ")
    ColorListComboB ox.Items.Add(" Silver ")
    ColorListComboB ox.Items.Add(" Gold ")
    ColorListComboB ox.Items.Add(" White ")
    ColorListComboB ox.Items.Add(" Black ")
    End Sub
    End Class

    Comment

    Working...