Location Issue With Controls

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 7
Reputation: williams1987 is an unknown quantity at this point 
Solved Threads: 0
williams1987 williams1987 is offline Offline
Newbie Poster

Location Issue With Controls

 
0
  #1
Apr 13th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Location Issue With Controls

 
0
  #2
Apr 13th, 2008
post a screenshot
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 7
Reputation: williams1987 is an unknown quantity at this point 
Solved Threads: 0
williams1987 williams1987 is offline Offline
Newbie Poster

Re: Location Issue With Controls

 
0
  #3
Apr 13th, 2008
Here is the print screen, i have added notes showing where the boxes appeared wrongly

thankyou
Last edited by williams1987; Apr 13th, 2008 at 7:21 pm.
Attached Thumbnails
Location Error.JPG  
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Location Issue With Controls

 
0
  #4
Apr 13th, 2008
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 :
  1. Private Sub Tes2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. TextBox1.Visible = False
  3. With ComboBox1.Items
  4. .Add("yes")
  5. .Add("no")
  6. End With
  7. End Sub
  8.  
  9. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  10. If ComboBox1.SelectedItem = "yes" Then
  11. TextBox1.Visible = True
  12. Else
  13. TextBox1.Visible = False
  14. End If
  15. End Sub
Last edited by Jx_Man; Apr 13th, 2008 at 8:07 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 7
Reputation: williams1987 is an unknown quantity at this point 
Solved Threads: 0
williams1987 williams1987 is offline Offline
Newbie Poster

Re: Location Issue With Controls

 
0
  #5
Apr 14th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC