We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how can i put in column (datagrid) combo box

I am using VB.Net I want to put in one of the columns a combo box that related to a differnt table i am using MS SQLServer

12 Replies

Clay Burch August 13, 2002 12:37 PM UTC

Take a look at the Data bound combobox sample at the bottom of this FAQ. http://www.syncfusion.com/faq/winforms/search/480.asp

RA ramez August 14, 2002 07:04 PM UTC

but this one didn't work with i am using VB.NET if you have a sample code and it's already working give to me

Clay Burch August 14, 2002 10:02 PM UTC

So, you cannot get the VB.NET samples in the FAQ to work? What errors do you get? I think the only thing you would need to change is the connection string.

RA ramez August 16, 2002 07:24 AM UTC

it's not a connection . there in no DataGridComboBoxColumn in VB.Net

Clay Burch August 16, 2002 07:35 AM UTC

The DataGridComboBoxColumn class is defined in that sample. You would have to copy that code that defines the class DataGridComboBoxColumn from the sample to your project in order to use it.

RA ramez August 18, 2002 10:28 AM UTC

It works now thanks for your kind help

RA ramez August 18, 2002 03:22 PM UTC

i didn't add item in combobox but i use datasource from another table i display something and the value is another thing(not the same type) it's not work who can i solve this problem?????

Clay Burch August 18, 2002 08:42 PM UTC

The last sample in the same FAQ shows how you can use another datasource for the combobox.

RA ramez August 19, 2002 07:30 AM UTC

is this what you mean : ((FAQ:How do I use the DataColumn.Expression property to add a computed/combined column to my datagrid?)) this is not what i mean. i have a combobox in datagrid and this combobox has a datasource different(not like the datagrid another table)(ex.it display list of sex(male,female) and return (0,1)value into the datagrid) it display a list of item(by query) from table and the vaule is another attribute. when i used it in the datagrid it not work because it take the display item not the value for this item(ofcourse they are not the same type)

Clay Burch August 19, 2002 08:53 PM UTC

I mean the FAQ about putting comboboxes in a datagrid. http://www.syncfusion.com/faq/winforms/search/480.asp At the bottom of this FAQ, you will find: Databound ComboBox Sample
To use a databound combobox, you have to add overrides for SetColumnValueAtRow and GetColumnValueAtRow to switch the DisplayMember and ValueMember as you get and set the data from the underlying table. Also, you cannot have the ComboBox bound with the same BindingContext to the same datasource as the datagrid. You can download a working project (C#, VB) that implements a databound combobox in a datagrid.

Administrator February 21, 2007 09:34 AM UTC



>I mean the FAQ about putting comboboxes in a datagrid.
>
>http://www.syncfusion.com/faq/winforms/search/480.asp
>
>At the bottom of this FAQ, you will find:
>
>Databound ComboBox Sample

>To use a databound combobox, you have to add overrides for SetColumnValueAtRow and GetColumnValueAtRow to switch the DisplayMember and ValueMember as you get and set the data from the underlying table. Also, you cannot have the ComboBox bound with the same BindingContext to the same datasource as the datagrid. You can download a working project (C#, VB) that implements a databound combobox in a datagrid.
>

RO Rommel April 15, 2007 05:11 PM UTC

I have an issue using this combo box everytime im adding new record and select the item from the combo box it selects the top selected index automatically but once you move to another record it will show the correct selected item. How do I resolve this issue. I tried to run the sample VB.net code and its acts the same thing..
Loader.
Live Chat Icon For mobile
Up arrow icon