Hi all,

I am working on a simple form for work, which has multiple questions (labels) and text boxes and combo boxes (to answer the questions).

My issue is that i do not wish to show all the questions right from the start. Some questions will remain non-visible, until a previous question is answered by selecting either "Yes" or "No" from a combo box.

My problem is that, when i select "Yes" i have asked that the next "Label" be made visible which it does and that the next "Textbox or Combobox" be made visible, which it also does. BUT where as it places the label right underneath the previous question, it places the "Textbox or Combobox" at the bottom of the page, which i do not want.

I have already tried locking the location of the "Textbox or Combobox" but with no joy.
I also have Autoscroll enable on the form these controls are in.

Here is the code i am using:

Private Sub comboboxQuestion11_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboboxQuestion11.SelectedIndexChanged

        'If the product does need to be set to a specific tone, then this label is made visible'
        If comboboxQuestion11.Text = "Yes" Then
            lblQuestion12.Visible = True
        Else : lblQuestion12.Visible = False
        End If

        'If the product does need to be set to a specific tone, then this textbox is made visible'
        If comboboxQuestion11.Text = "Yes" Then
            txtboxQuestion12.Visible = True
        Else : txtboxQuestion12.Visible = False
        End If

    End Sub

If anyone could make some suggestions on how to stop this, that would be geat.

Thankyou

post a screenshot

Here is the print screen, i have added notes showing where the boxes appeared wrongly

thankyou

why u put box behind another control?
you want to show first textbox after user select yes on first combo box.right?
set first textbox visible = false when form load then after user select yes u can set visible to true. so u don't have to put box behind combox.
See this example :

Private Sub Tes2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Visible = False
        With ComboBox1.Items
            .Add("yes")
            .Add("no")
        End With
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.SelectedItem = "yes" Then
            TextBox1.Visible = True
        Else
            TextBox1.Visible = False
        End If
    End Sub

Yes that is what i did, but when i then select "Yes" from the combo box. Which makes the next box visible. It makes it visible but in completely the wrong place. thats the problem.

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.