简体   繁体   中英

Assign display value from a combo box to another text

I am having code to display combo box such as

da.Fill(ds1, "HDTYPE");
comboHD.DisplayMember = "hw_define";
comboHD.ValueMember = "hwd_Id";
comboHD.DataSource = ds1.Tables["HDTYPE"];

The problem is I want to assign the selected text ie, hw_define to another text field for printing the data and hwd_Id to database for saving the data. I'm able to get the selected ID( hwd_id ) by using hwtype.SelectedValue . But how can I get selected - hw_define text to assign another text box?

您可以使用comboHD.Text使其值显示在组合框中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM