1
Answer

How to add value into Textbox from Textboxlist

Xiaoliang Ma

Xiaoliang Ma

6y
942
1
I have below code to add int n into Textbox from Textboxlist, but when running this program, both textboxes dont have anything. Thanks in advance for any suggestion
  1. private void btnLoad_Click(object sender, RoutedEventArgs e)  
  2. {  
  3. List<TextBox> IDtextBoxList = new List<TextBox>();  
  4. IDtextBoxList.Add(new TextBox { Text = txtboxpbM1.Text });  
  5. IDtextBoxList.Add(new TextBox { Text = txtboxpbM2.Text });  
  6. for (int n = 0; n < IDtextBoxList.Count; n++)  
  7. {  
  8. IDtextBoxList[n].Text = n.ToString();  
  9. }  
  10. }
Answers (1)