[英]How to get selected row values to combo box from data gridview in c#
試試這個。
ar.txtcombo.SelectedIndex = ar.txtcombo.FindString(
this.dataGridView1.CurrentRow.Cells[6].Value.ToString());
我認為這會有所幫助:)
int class= int.Parse(row.Cells[6].Value.ToString());
NameOfYourComboBox.SelectedValue = class;
如果該值不在數據庫中,則可以使用此值;
NameOfYourComboBox.Text = row.Cells[6].Value.ToString();
我已經嘗試了很多次,並且對WinForms來說效果很好
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.