Results 1 to 3 of 3

Thread: [2008] How to make column 3 of datagridview that is bound to a datatable a combobox

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    [2008] How to make column 3 of datagridview that is bound to a datatable a combobox

    Hi Guys,

    I have a column that is either Incoming or Outgoing. How can I make those 2 choices available from a combobox in my bound datagridview. Please help me

  2. #2

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: [2008] How to make column 3 of datagridview that is bound to a datatable a combobox

    Guys, I've gotten this far: I add another column and assign it the two values it can have, but how do I link it to my datatable value for CallType. Please help me.

    Code:
     Dim comboboxcol As New DataGridViewComboBoxColumn
    
            Try
                Using con As New MySqlConnection(myConnStr)
    
                    adapter = New MySqlDataAdapter("SELECT CallId,CallDate,UserComment,CallType FROM tblcall WHERE ifkpeopleid = " & Pid & ";", con)
    
                    calltable.Clear()
                    adapter.Fill(calltable)
    
                    dgvCalls.DataSource = calltable
                    comboboxcol.HeaderText = "Call Type"
                    comboboxcol.Items.Add("Incoming")
                    comboboxcol.Items.Add("Outgoing")
                    dgvCalls.Columns.Add(comboboxcol)
                    
                End Using
    
            Catch ex As Exception
                MsgBox(ex)
    
    
            End Try

  3. #3

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: [2008] How to make column 3 of datagridview that is bound to a datatable a combobox

    yipee, I've added this code after adding my comboboxcolumn:

    Code:
     comboboxcol.DataPropertyName = "CallType"
    and it works. But I now have one column with calltype which is not a combo and 1 column which is a combo. How can I make column 3 the combo1

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