Output Screenshot:
int cleft=1; //for the position of TextBoxes .
we need to create a button handler to create textboxes because we are creating a function AddNewTextBox from class TextBox.
private void createButton_Click(object sender, EventArgs e)
{
AddNewTextBox();
}
public TextBox AddNewTextbox()
{
TextBox txt=new TextBox();
this.Controls.Add(txt);
txt.Top=cleft*25;
txt.Left=100;
txt.Text="TextBox" + this.cleft.ToString();
cleft=cleft+1;
return txt;
}
No comments:
Post a Comment