[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");
Re: Hiding/Unhiding txt boxes on a form
Look at the combo boxes selected index changed event
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?
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.
Re: Hiding/Unhiding txt boxes on a form
Of course, something so simple. Thanks!