Hi all,
I am having a small problem on getting the values of the dynamically generated textboxes in C# windows application. I have successfully read an xml file and put its key and value fields as Label and TextBox respectively. Now what I need is the user changes the values in one of the textBox and I need to get that value. The problem is I cannot get the values from the textbox i.e. I don't know how to get the particular textbox value. Can anyone help me?
Thanks in advance.
This is how I made the Label and TextBox dynamically
Label label = new Label();
label.Name = "lbl" + lblID;
label.Text = str2;
label.Visible = true;
label.SetBounds (5, y, 125, 20);
viewPanel.Contr ols.Add(label);
viewPanel.Visib le = true;
lblID++;
txtBox = new TextBox();
txtBox.Name = "txtBox" + txtBoxID;
txtBox.Text = str2;
txtBox.Visible = true;
txtBox.SetBound s(140, y, 300, 20);
viewPanel.Contr ols.Add(txtBox) ;
viewPanel.Visib le = true;
txtBoxID++;
now how can i get the values out from each of the textboxes?
I am having a small problem on getting the values of the dynamically generated textboxes in C# windows application. I have successfully read an xml file and put its key and value fields as Label and TextBox respectively. Now what I need is the user changes the values in one of the textBox and I need to get that value. The problem is I cannot get the values from the textbox i.e. I don't know how to get the particular textbox value. Can anyone help me?
Thanks in advance.
This is how I made the Label and TextBox dynamically
Label label = new Label();
label.Name = "lbl" + lblID;
label.Text = str2;
label.Visible = true;
label.SetBounds (5, y, 125, 20);
viewPanel.Contr ols.Add(label);
viewPanel.Visib le = true;
lblID++;
txtBox = new TextBox();
txtBox.Name = "txtBox" + txtBoxID;
txtBox.Text = str2;
txtBox.Visible = true;
txtBox.SetBound s(140, y, 300, 20);
viewPanel.Contr ols.Add(txtBox) ;
viewPanel.Visib le = true;
txtBoxID++;
now how can i get the values out from each of the textboxes?
Comment