J
John Talli
I have a DataGridView called "ucGrdLCbx_DGV".
I have added a DataGridViewComboBoxColumn to the first column.
Everything works fine except the default value "Local" never
is display at the first selection. The first selection just
stays blank.
I would like the item "Local" to display as the default value
when the grid gets loaded.
What am I doing wrong. THANKS
With Me.ucGrdLCbx_DGV ' ucGrdLCbx_DGV = DataGridView
.Columns.Clear()
.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
.CellBorderStyle = DataGridViewCellBorderStyle.Single
.GridColor = Color.Black
.RowHeadersVisible = False
.AllowUserToAddRows = False
.AllowUserToDeleteRows = False
' Combobox to first column
Dim ctl As New DataGridViewComboBoxColumn
ctl.Name = "Colmn1"
ctl.HeaderText = "ColmnHdr"
ctl.Width = 75
ctl.Items.Add("None") '
ctl.Items.Add("Local")
ctl.ValueMember = "Local" <<< Default value NEVER shows
' Add the combobox to the DataGridView
.Columns.Add(ctl)
' Bind dataTable to DataGridView
ucGrdLCbx_DGV.DataSource = p_DataTbl
End With
'' ''For Each itm As DataGridViewRow In Me.ucGrdLCbx_DGV.Rows << I also tried
this but it didn't work
'' '' itm.Cells(0).Value = "Local"
'' ''Next
'' ''For Each itm As DataGridViewRow In Me.ucGrdLCbx_DGV.Rows << I also tried
this but it didn't work
'' '' Dim ctl As New DataGridViewComboBoxCell
'' '' ctl = CType(itm.Cells(0), DataGridViewComboBoxCell)
'' '' ctl.ValueMember = "Local"
'' ''Next
I have added a DataGridViewComboBoxColumn to the first column.
Everything works fine except the default value "Local" never
is display at the first selection. The first selection just
stays blank.
I would like the item "Local" to display as the default value
when the grid gets loaded.
What am I doing wrong. THANKS
With Me.ucGrdLCbx_DGV ' ucGrdLCbx_DGV = DataGridView
.Columns.Clear()
.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
.CellBorderStyle = DataGridViewCellBorderStyle.Single
.GridColor = Color.Black
.RowHeadersVisible = False
.AllowUserToAddRows = False
.AllowUserToDeleteRows = False
' Combobox to first column
Dim ctl As New DataGridViewComboBoxColumn
ctl.Name = "Colmn1"
ctl.HeaderText = "ColmnHdr"
ctl.Width = 75
ctl.Items.Add("None") '
ctl.Items.Add("Local")
ctl.ValueMember = "Local" <<< Default value NEVER shows
' Add the combobox to the DataGridView
.Columns.Add(ctl)
' Bind dataTable to DataGridView
ucGrdLCbx_DGV.DataSource = p_DataTbl
End With
'' ''For Each itm As DataGridViewRow In Me.ucGrdLCbx_DGV.Rows << I also tried
this but it didn't work
'' '' itm.Cells(0).Value = "Local"
'' ''Next
'' ''For Each itm As DataGridViewRow In Me.ucGrdLCbx_DGV.Rows << I also tried
this but it didn't work
'' '' Dim ctl As New DataGridViewComboBoxCell
'' '' ctl = CType(itm.Cells(0), DataGridViewComboBoxCell)
'' '' ctl.ValueMember = "Local"
'' ''Next