111,123
社区成员
发帖
与我相关
我的任务
分享
DataRowView dv=this.listbox.SelectedItem as DataRowView
if (dv!= null)
{
this.textBox.Text=dv[1].ToString();
}
DataRowView dv=this.listbox.SelectedItem as DataRowView
if (dv!= null)
{
this.textBox.Text=dv[1].ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
string[] args = {"a","b","c" };
this.listBox1.DataSource = args;
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//在各自的判断里面取到值以后到数据库中查,然后赋值。
if (this.listBox1.SelectedItem.ToString().Equals("a"))
{
this.textBox1.Text = "a1";
this.textBox2.Text = "a2";
}
if (this.listBox1.SelectedItem.ToString().Equals("b"))
{
this.textBox1.Text = "b1";
this.textBox2.Text = "b2";
}
if (this.listBox1.SelectedItem.ToString().Equals("c"))
{
this.textBox1.Text = "c1";
this.textBox2.Text = "c2";
}
}