473,245 Members | 1,801 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,245 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 2857
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: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.