954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Associate VB2008 ComboBox with CheckBoxes

Hi,

I am building my first VB2008 application and I am trying to figure out a way to make some check boxes being checked when an entry from a combo box is selected on top of these check boxes. More specific, I am trying to describe the services offered in 3 hotel room types. i.e. If the user selects from the combo box the room type "Economy" some extras will be automatically checked (TV, mini bar, etc). If the user selects "Premium" some more check boxes will be checked. That's the idea.

Any help would be greatly appreciated.

Thanks.

manowar666
Newbie Poster
2 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Go to the ComboBox1_SelectedIndexChanged event, and add an if-statement similar to the one below:

If ComboBox1.SelectedItem = "Economy" Then
            CheckBox1.Checked = True
            CheckBox2.Checked = True
            CheckBox3.Checked = False
            CheckBox4.Checked = False
            CheckBox5.Checked = False
        ElseIf ComboBox1.SelectedItem = "Premium" Then
            CheckBox1.Checked = True
            CheckBox2.Checked = True
            CheckBox3.Checked = True
            CheckBox4.Checked = False
            CheckBox5.Checked = False
        ElseIf ComboBox1.SelectedItem = "Executive" Then
            CheckBox1.Checked = True
            CheckBox2.Checked = True
            CheckBox3.Checked = True
            CheckBox4.Checked = True
            CheckBox5.Checked = True
End If


I must say, if you need help with something so simple, you really have problems, if took like 1 minute to make a simple program like this.

crazyhorse09
Junior Poster in Training
62 posts since Mar 2009
Reputation Points: 19
Solved Threads: 7
 

First of all thank you. It worked like a charm :)

Second, regarding the "problems" comment, I have to say that is my first time programming on VB, and I am trying to finish a project that my part is only the UI. I just needed the code above in order for a colleague of mine to grasp the idea of my UI when I sent it to him.

Thanks though once again.

manowar666
Newbie Poster
2 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: