473,396 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub ColorListComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorListComboBox.SelectedIndexChanged
  3.  
  4.     End Sub
  5.  
  6.     Private Sub Selectbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Selectbtn.Click
  7.         Select Case ColorListComboBox
  8.             Case 0
  9.                 Angerpnl.Visible = True
  10.             Case 1
  11.                 Joypnl.Visible = True
  12.             Case 2
  13.                 Joypnl.Visible = True
  14.             Case 3
  15.                 Sadnesspnl.Visible = True
  16.             Case 4
  17.                 Disgustpnl.Visible = True
  18.             Case 5
  19.                 Disgustpnl.Visible = True
  20.             Case 6
  21.                 Fearpnl.Visible = True
  22.             Case 7
  23.                 Fearpnl.Visible = True
  24.             Case 8
  25.                 Joypnl.Visible = True
  26.             Case 9
  27.                 Angerpnl.Visible = True
  28.             Case 10
  29.                 Angerpnl.Visible = True
  30.             Case 11
  31.                 Sadnesspnl.Visible = True
  32.             Case 12
  33.                 Disgustpnl.Visible = True
  34.             Case 13
  35.                 Fearpnl.Visible = True
  36.             Case 14
  37.                 Sadnesspnl.Visible = True
  38.             Case Else
  39.                 Errorlbl.Visible = True
  40.         End Select
  41.     End Sub
  42.  
  43.     Private Sub Exitbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exitbtn.Click
  44.         End
  45.     End Sub
  46.  
  47. End Class
  48.  
  49.  
  50.  
Attach is a Scrrencap of my Design
Attached Images
File Type: jpg Untitled.jpg (212.8 KB, 65 views)
Dec 4 '20 #1

✓ answered by CollegeStud

Answer:
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.SelectedIndex
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

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

1 2864
Answer:
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.SelectedIndex
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

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ColorListComboBox.Items.Add(" Red ")
ColorListComboBox.Items.Add(" Orange ")
ColorListComboBox.Items.Add(" Yellow ")
ColorListComboBox.Items.Add(" Blue ")
ColorListComboBox.Items.Add(" Green ")
ColorListComboBox.Items.Add(" Indigo ")
ColorListComboBox.Items.Add(" Purple ")
ColorListComboBox.Items.Add(" Turquoise ")
ColorListComboBox.Items.Add(" Pink ")
ColorListComboBox.Items.Add(" Brown ")
ColorListComboBox.Items.Add(" Gray ")
ColorListComboBox.Items.Add(" Silver ")
ColorListComboBox.Items.Add(" Gold ")
ColorListComboBox.Items.Add(" White ")
ColorListComboBox.Items.Add(" Black ")
End Sub
End Class
Dec 4 '20 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
2
by: JMCN | last post by:
hello i have your basic select case question. i created a combo box and save it as a query. so whenever the user selects the value and clicks the export button, the select case should then export...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
1
by: billypit | last post by:
Hi, I am totaly new to MS Access. I have one form in MS Access in which i want that whenever i select an item from combobox then in the textbox on the same form or subform i want value from table...
3
by: ndeeley | last post by:
Hi there, I've not used Select Case statements, and as MS Access help is as much use as a chocolate teapot I thought I'd post my query here. I have a combo box showing Task Summaries. When a...
1
by: rajanji | last post by:
Hi all , I am new to ASP.NET and need ur help for How to write the source code for downloading a file in ASP.NET 2005 using a combobox... i.e suppose i have five files in my website and i want to...
44
by: Desitech | last post by:
I am very new at this and trying to learn. I have built a database and on my main form, I have a combo box titled cbodocumenttype, a text box for user input entitled txtuserinput, and a command...
11
by: WannabePrgmr | last post by:
In access 2003, on a simple form, I am trying to base the recordsource of a combobox on two other combobox's data. Here is the code I've tried and it did not work (except for the PN Cross/Info). ...
2
by: Saumitra Kumar Paul | last post by:
Dear Friend, I am trying to write code as the following- For Each ControlObject As Control In Me.Controls Select Case TypeOf ControlObject Case TextBox
13
by: pbcompgeek | last post by:
I've been trying to open some applications (.exe) that are on my flash drive using multiple ComboBox's to select the different types of programs and a button to lauch the selected program. My issue...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.