Hi,
i'm trying to get a dropdown in a filled datagrid, the code i have so far is :
On the last command i'm getting an error :Code:Dim mycommand3 As New MySqlCommand Dim myadapter3 As New MySqlDataAdapter Dim sql As String Dim mydata3 As New DataTable sql = "select Lasnummer,diameter1 from lisl_gegevens_new where Isonummer ='" & isonr & "' order by lasnummer;" Connectdb() mycommand3.Connection = conn mycommand3.CommandText = sql myadapter3.SelectCommand = mycommand3 myadapter3.Fill(mydata3) ListLas.lassen.DataSource = mydata3 Dim dgvcolumn As New DataGridViewComboBoxColumn For a As Integer = 1 To 10 dgvcolumn.Items.Add(CStr(a)) Next a dgvcolumn = ListLas.lassen.Columns(1)
Unable to cast object of type 'System.Windows.Forms.DataGridViewTextBoxColumn' to type 'System.Windows.Forms.DataGridViewComboBoxColumn'.
Could some explain to me how this is done correctly. The datagrid itself is filled correctly.
Thanks in advance
Erwin




Reply With Quote