|
-
Jul 25th, 2008, 04:58 AM
#1
Thread Starter
PowerPoster
[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
-
Jul 25th, 2008, 06:39 AM
#2
Thread Starter
PowerPoster
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
-
Jul 25th, 2008, 06:52 AM
#3
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|