01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.ComponentModel;
04.
using
System.Data;
05.
using
System.Drawing;
06.
using
System.Linq;
07.
using
System.Text;
08.
using
System.Windows.Forms;
09.
10.
namespace
Q1_DDL_TX
11.
{
12.
public
partial
class
Form1 : Form
13.
{
14.
public
Form1()
15.
{
16.
InitializeComponent();
17.
}
18.
19.
private
void
Form1_Load(
object
sender, EventArgs e)
20.
{
21.
loadDD();
22.
}
23.
24.
private
void
loadDD()
25.
{
26.
var S = 5;
27.
for
(
int
i = 1; i <= S; i++)
28.
{
29.
comboBox1.Items.Add(i);
30.
}
31.
}
32.
private
void
comboBox1_SelectedIndexChanged(
object
sender, EventArgs e)
33.
{
34.
35.
var s = Convert.ToInt32(comboBox1.SelectedItem.ToString());
36.
for
(
int
i = 0; i < s; i++)
37.
{
38.
TextBox textbox =
new
TextBox();
39.
int
count = panel1.Controls.OfType<TextBox>().ToList().Count; ;
40.
textbox.Location =
new
System.Drawing.Point(60, 25 * count);
41.
textbox.Size =
new
System.Drawing.Size(80, 20);
42.
textbox.Name =
"textbox_"
+ (count + 1);
43.
textbox.TextChanged +=
new
System.EventHandler(
this
.TextBox_Changed);
44.
panel1.Controls.Add(textbox);
45.
46.
}
47.
}
48.
49.
private
void
TextBox_Changed(
object
sender, EventArgs e)
50.
{
51.
throw
new
NotImplementedException();
52.
}
53.
}
54.
}