Xiaoliang Ma

Xiaoliang Ma

  • 2k
  • 6
  • 1.1k

How to add value into Textbox from Textboxlist

Jul 31 2018 10:15 PM
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. }

Brought to you by:

Answers (1)