Results 1 to 3 of 3

Thread: dropdown in a gridview ?

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    10

    dropdown in a gridview ?

    Hi,

    i'm trying to get a dropdown in a filled datagrid, the code i have so far is :

    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)
    On the last command i'm getting an error :

    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
    Last edited by etsoft; Dec 30th, 2007 at 08:28 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width