有一个textbox,button,gridview...现在要在textbox中输入查询字符串,再在gridview中显示出来... 5
1个回答
展开全部
//这个不需要数据库,先把你说的控件放到Form1窗体上
public Form1()
{
InitializeComponent();
_dt.Columns.Add(new DataColumn("Value", typeof(string)));
}
private readonly DataTable _dt = new DataTable();
private void button1_Click(object sender, EventArgs e)
{
_dt.Rows.Add(textBox1.Text);
dataGridView1.DataSource = _dt;
}
public Form1()
{
InitializeComponent();
_dt.Columns.Add(new DataColumn("Value", typeof(string)));
}
private readonly DataTable _dt = new DataTable();
private void button1_Click(object sender, EventArgs e)
{
_dt.Rows.Add(textBox1.Text);
dataGridView1.DataSource = _dt;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询