Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Creating Windows Form controls during execution
  2. TextBox textBox = new TextBox();
  3. textBox.Location = Some Point on your form or container.
  4. this.Controls.Add(textBox);
  5.        
  6. int topValue = 0;
  7. for (int i = 0; i < numericUpDown1.Value; i++) {
  8.   TextBox textbox = new TextBox();
  9.   textBox.Location = new Point(0, topValue);
  10.   this.Controls.Add(textBox);
  11.  
  12.   topValue += textBox.Height + 2;
  13. }
  14.        
  15. numericUpDown1.Maximum = int.Parse(textBox1.Text);