Hello All,
I am creating a windows form that has a keypad on it, and three text input boxes. I need to be able to input numbers using the keypad and upon hitting enter, have it fill in in each of three box categories "a" "b" "c". The categories never change, but I need the scrollbox that they are kept in to dynamically generate new boxes with the same heading. I.e. I need the user to be able to enter these three values an unlimited amount of times. How do I make the input boxes appear when the user has filled all of the one's currently available?
Loading
Roei BarPosted Sep 15, 2009, 1:06 AM
split the Panel into 3 TextBox
outside the Panel you have a Button
on the Button Click Event you do the following:
bool isEmptyTextBox = false;
foreach(Control item in Panel.Controls)
{
if(item.Text == string.Empty)//Means it doesnt have text in it
{
isEmptyTextBox = true;
break;
}
}
return isEmptyTextBox;
now if you get "true" you do nothing
if you get "false" then you will need todo the following
give the TextBox all needed identifiers and location and then
TextBox newTextBox = new TextBox();
Panel.Controls.Add(newTextBox );
M LPosted Sep 14, 2009, 4:19 PM
Roei BarPosted Sep 14, 2009, 4:18 PM
create a Panel holding those 3 TextBox then you can run on the
Panel.Controls and check if there is non with Text equals string.empty then add 3 new TextBox
and for the scrollbars just put the ScrollBar to Automatic on the Panel and it will be available once needed