2014-02-24 58 views
0

如何將displaymember下面的代碼設置爲文本框或列表框?無論如何要將組合框的顯示成員添加到文本框?

product_combobox.DataSource = supp; 
product_combobox.DisplayMember = "PProduct_name"; 
product_combobox.ValueMember = "PProduct_id"; 

我使用下面的方法:

string name = product_combobox.SelectedItem.ToString(); 

textbox1.text= name; 

但它不是爲我工作。 雖然我能夠獲取價值成員。任何幫助?

回答

0

而是使用下面的代碼

string name = product_combobox.Text; 
textbox1.text= name; 
0
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    textBox1.Text = comboBox1.Text.ToString(); 
} 
相關問題