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.

Recommended Answers

All 2 Replies

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.