The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Creating Dynamic TextBox and Get Its Value
2 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Kumar SambhaveditedPosted May 17, 2013, 3:23 AMEdited May 17, 2013, 4:38 AM
Please check this codding is working properly in Windows Application ************************************************* using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace DynamicTexBox { public partial class Form2 : Form { public Form2() { InitializeComponent(); } TextBox[] textBoxes; private void button1_Click(object sender, EventArgs e) { int value = 3; textBoxes = new TextBox[value]; for (int i = 1; i < value; i++) { textBoxes[i] = new TextBox(); textBoxes[i].SetBounds(30, i * 30, 60, 20); this.Controls.Add(textBoxes[i]); } } private void button2_Click(object sender, EventArgs e) { int myTotal = 0; foreach (Control ctl in this.Controls) { if (ctl.GetType() == typeof(TextBox)) { myTotal += Convert.ToInt32(ctl.Text); } } label1.Text = myTotal.ToString(); } } }
Gihan PereraPosted Jan 3, 2011, 2:38 AM
i need get value from dynamic created textbox in windows forms(not web forms).