TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Arun Kurmi
NA
104
103.5k
How to remove dynamic control from Form
Mar 19 2013 11:12 AM
I have 2 problems related to dynamic control.
1)
I hava a array txt to cteate no. of dynamic textbox at run time, i does this successfully.I want remove previously created textbox and add new textboxes to form on button click.
private void button1_Click(object sender, EventArgs e)
{
//txt.Controls.Remove();
//txt[n].Controls.Clear();
n=Convert.ToInt16(textBox1.Text);
txt = new TextBox[n];
for (int i = 0; i < n; i++)
{
txt[i] = new TextBox();
this.Controls.Add(txt[i]);
txt[i].Location = new Point(textBox1.Location.X, textBox1.Location.Y + (i + 1) * 40);
txt[i].BackColor = Color.FromArgb(r.Next(255), r.Next(255), r.Next(255));
txt[i].Text = "This is Dynamic TextBox" + (i + 1);
txt[i].Size = new Size(150, 10);
}
}
-----------------------------------------------------------------------
2)
how to use textbox.text property with dynamic textbox to use text of textbox.
for ex. i want display a messegebox with text of dynamic textbox.
Reply
Answers (
1
)
filter datagrid by different criteria
What is Web 2.0 and how is it different from Web 1.0?