Reputation: 13
Actually I'm facing problems with my textboxes and just to say that its my first Visual C# Application i do.
I just have many textboxes, around 14 textboxes and all i want is that after the user enter the values in each on i need this value to be saved in an array Temp[]
for example (
textbox1.text=1 so Temp[0]=1
textbox2.text=4 so Temp[1]=4
and etc....
I've included also a pic for my app:
so as you can see i the user must enter values for the first set and another values for the second set and i need to save the entered values in each set in an array to show later the union and the intersection of the sets.
Upvotes: 0
Views: 853
Reputation: 2938
Try this.
For 1st panel
int a=0;
foreach (TextBox tbx in Panel1.Controls.OfType<TextBox>())
{
Temp1[a]= tbx.text ;
a++;
}
For 2nd Panel a=0;
foreach (TextBox tbx in Panel2.Controls.OfType<TextBox>())
{
Temp2[a]= tbx.text ;
a++;
}
Edit: You have to define 1st set of textboxes in panel1 and 2nd set in panel2.
Upvotes: 1