Hi,
If comboboxcolumn.datasource contains the boundtext, this will make comboboxcolumn show the correct display text.
You can try the following example.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'DataGridView datasource
Dim dt01 As DataTable = New DataTable()
dt01.Columns.Add("Mill")
dt01.Columns.Add("tag")
dt01.Rows.Add("01", "test01")
dt01.Rows.Add("02", "test02")
'comboboxcolumn datasource
Dim dt02 As DataTable = New DataTable()
dt02.Columns.Add("DepartmentName")
dt02.Columns.Add("DepartmentID")
dt02.Rows.Add("name01", "01")
dt02.Rows.Add("name02", "02")
DataGridView1.AutoGenerateColumns = False
DataGridView1.DataSource = dt01
Dim Col_Mill As New DataGridViewComboBoxColumn
With Col_Mill
.Name = "Mill"
.DataPropertyName = "Mill"
.DisplayMember = "DepartmentName"
.ValueMember = "DepartmentID"
.DataSource = dt02
.Width = 150
End With
Dim datagridviewtextboxcolumn As New DataGridViewTextBoxColumn
With datagridviewtextboxcolumn
.Name = "tag"
.DataPropertyName = "tag"
End With
DataGridView1.Columns.Add(Col_Mill)
DataGridView1.Columns.Add(datagridviewtextboxcolumn)
End Sub
If you have further questions, please feel free to tell me.
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.