C# textbox输入listbox显示

来源:百度知道 编辑:UC知道 时间:2024/05/26 19:31:33
如何实现呀?由于是新手,所以希望要点具体代码,谢谢啦!
是在textbox中输入value的值(code),在listbox中显示其name!都是数据库的内容,我已经邦定了!

protected void Button1_Click(object sender, EventArgs e)
{
ListBox1.Items.Clear();
ListBox1.Items.Add(TextBox1.Text.ToString());
}

需要 一个TextBox1一个ListBox1一个Button1 .点Button1 即实现

啥意思啊!是不是在textbox中输入值然后在listbox中显示,如果这样就太简单啦!能不能说的详细点……

补充一下吧,没明白你的意思

protected void btnAdd_Click(object sender, EventArgs e)
{
if(!string.IsNullOrEmpty(TextBox1.Text))
{
ListBox1.Items.Add(TextBox1.Text);
}
}