am Really new in vb and this has been giving heck of worries

i have a combo box with about 13 collections. i want when a user selects an option, it should open in a new form. the problem now is when a user clicks on an option, all the 13 forms will open. please help
here is my code

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ComboBox1.SelectedValue = "1"
        Form2.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "2"
        Form3.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "3"
        Form4.Show()
        ComboBox1.SelectedValue = "4"
        Form3.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "5"
        Form5.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "6"
        Form6.Show()
        ComboBox1.SelectedValue = "7"
        Form7.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "8"
        Form8.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "9"
        Form9.Show()
        ComboBox1.SelectedValue = "10"
        Form9.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "11"
        Form10.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "12"
        Form11.Show()
        Me.Hide()
        ComboBox1.SelectedItem = "13"
        Form12.Show()
        Me.Hide()
    End Sub

Someone should help Asap

Recommended Answers

Reginald - do us a favour and post to the right forum. This is NOT the VB forum - it is a Community Forum. Also you can use more unique tags.

Someone should help Asap

Must be a language thing. Chill out Reginald - post your code …

Jump to Post

All 2 Replies

Member Avatar

Reginald - do us a favour and post to the right forum. This is NOT the VB forum - it is a Community Forum. Also you can use more unique tags.

Someone should help Asap

Must be a language thing. Chill out Reginald - post your code questions to the right forum and you may get prompt replies. "ASAP" has no meaning here. We give our time for free - you have no say in how quickly we do it.

Use a select case statement here. As your code is written now it will indeed open all your froms and hide the one you're in.
Follow the advice of diafol.

Be a part of the DaniWeb community

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