|
-
August 13th, 2011, 07:01 PM
#1
[RESOLVED] Hiding/Unhiding txt boxes on a form
I have a combo box on my form, that has 2 options to select from. When my form loads, under the form_Load() Event I have numerous text boxes set to ...Visible = False; Depending upon what selection is chosen within that combo box, I want specific text boxes to become viewable.
I.E. If comboboxAnswer = Tester1
{
...Visible = True;
...Visible = True;
}
But I don't know where these lines of code would need to go that would let those text boxes be visible.
Code:
Private Void Form_Load()
txtAirlineName.Visible = false;
txtNumberofPassengers.Visible = false;
txtFlightNumber.Visible = false;
txtFighterType.Visible = false;
lblPassengerPlaneData.Visible = false;
lblAirlineName.Visible = false;
lblNumberofPassengers.Visible = false;
lblFlightNumber.Visible = false;
lblFighterJetPlaneType.Visible = false;
lblFighterType.Visible = false;
cboAA.Items.Add("Test1");
cboAA.Items.Add("Test2");
Last edited by jo15765; August 13th, 2011 at 07:43 PM.
-
August 13th, 2011, 07:55 PM
#2
Re: Hiding/Unhiding txt boxes on a form
Look at the combo boxes selected index changed event
Always use [code][/code] tags when posting code.
-
August 13th, 2011, 08:49 PM
#3
Re: Hiding/Unhiding txt boxes on a form
Great, now my next ? is. I have a Create button on the form, that runs some code, and in will display the results. If once the results are displayed, I decide to change from Test1 to Test2, how can I then tell the form to hide the text boxes that belong to Test1 and only display the textboxes that belong to Test2?
Last edited by jo15765; August 13th, 2011 at 09:00 PM.
-
August 13th, 2011, 09:58 PM
#4
Re: Hiding/Unhiding txt boxes on a form
Set the visible property to false at whatever time you want the box to be hidden and to true when you want it shown.
Always use [code][/code] tags when posting code.
-
August 14th, 2011, 08:39 AM
#5
Re: Hiding/Unhiding txt boxes on a form
Of course, something so simple. Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|