Hi,
how can I change a DataColumn to ComboBox type column in a DataSet?
After I add a new column into the DataSet using

MyDataSet.DataTable.Columns.Add("ColName");

I'd like to change its type so it would appear as a
DataGridViewComboBoxColumn in a DataGridView bound to this DataTable.

I also tried to create the ComboBox type column in the DataSet directly,
but failed (the Add method allows to create DataColumn columns only).

Or: could it be done by changing the column type in the DataGridView? If
so, how?

Thanks...

With regards
nvx

Re: How to change a DataColumn to ComboBox type column in a DataSet? by Dmytro

Dmytro
Wed Jul 19 02:43:03 CDT 2006

Hi Nvx,

Your question doesn't have anything to do with DataSet. What you need
instead is to properly configure the ColumnStyles collection of the DataGrid
so a data column with a particular name is represented by the ComboBox
column style.

--
Regards,
Dmytro Lapshyn [MVP]
http://blogs.vbcity.com/DmytroL

"nvx" <nvx2004@hotmail.com> wrote in message
news:%23f7jFipqGHA.4684@TK2MSFTNGP05.phx.gbl...
> Hi,
> how can I change a DataColumn to ComboBox type column in a DataSet?
> After I add a new column into the DataSet using
>
> MyDataSet.DataTable.Columns.Add("ColName");
>
> I'd like to change its type so it would appear as a
> DataGridViewComboBoxColumn in a DataGridView bound to this DataTable.
>
> I also tried to create the ComboBox type column in the DataSet directly,
> but failed (the Add method allows to create DataColumn columns only).
>
> Or: could it be done by changing the column type in the DataGridView? If
> so, how?
>
> Thanks...
>
> With regards
> nvx


Re: How to change a DataColumn to ComboBox type column in a DataSet? by nvx

nvx
Wed Jul 19 03:52:27 CDT 2006

Thank you, Dmytro...

After posting the first question I looked at the DB in Access and found
out that there is not possible to set such a column type. Hence I
deleted the post you have replied to and posted another question (see
"How to change a DataGridViewTextBoxColumn to a
DataGridViewComboBoxColumn?") since I was not able to change it in the
DGV. Could you please give an exact line of code, which does this thing?

Thank you in advance.

With regards
nvx


Dmytro Lapshyn [MVP] napsal(a):
> Hi Nvx,
>
> Your question doesn't have anything to do with DataSet. What you need
> instead is to properly configure the ColumnStyles collection of the
> DataGrid so a data column with a particular name is represented by the
> ComboBox column style.
>

Re: How to change a DataColumn to ComboBox type column in a DataSet? by nvx

nvx
Wed Jul 19 03:58:03 CDT 2006

Oh, I'm sorry, I forgot to add I'm coding in C#...

nvx


nvx napsal(a):
> Thank you, Dmytro...
>
> After posting the first question I looked at the DB in Access and found
> out that there is not possible to set such a column type. Hence I
> deleted the post you have replied to and posted another question (see
> "How to change a DataGridViewTextBoxColumn to a
> DataGridViewComboBoxColumn?") since I was not able to change it in the
> DGV. Could you please give an exact line of code, which does this thing?
>
> Thank you in advance.
>
> With regards
> nvx
>
>
> Dmytro Lapshyn [MVP] napsal(a):
>> Hi Nvx,
>>
>> Your question doesn't have anything to do with DataSet. What you need
>> instead is to properly configure the ColumnStyles collection of the
>> DataGrid so a data column with a particular name is represented by the
>> ComboBox column style.
>>

Re: How to change a DataColumn to ComboBox type column in a DataSet? by edgarrolla

edgarrolla
Tue Jul 25 09:43:05 CDT 2006

Is it possible to be done in run time?
Is it actually possible to change a single cell style programmacticaly?

cheers!

nvx escreveu:

> Oh, I'm sorry, I forgot to add I'm coding in C#...
>
> nvx
>
>
> nvx napsal(a):


Re: How to change a DataColumn to ComboBox type column in a DataSet? by Paul

Paul
Tue Jul 25 10:45:00 CDT 2006

Well, it can be done with

DataGridViewCell cell = new DataGridViewComboBoxCell();
DGV.Columns["colname"].CellTemplate = cell;

There's a catch though: the new column type must be derived from the
actual type or something like that, I do not remember it exactly... If
it is possible, try to create columns of needed type and you're saved
from changing theirs type in the future. I know this solution can't be
applied to every case, but to most of them it can, I guess...

P.J.


edgarrolla@yahoo.com.br napsal(a):
> Is it possible to be done in run time?
> Is it actually possible to change a single cell style programmacticaly?
>
> cheers!
>
> nvx escreveu:
>
>> Oh, I'm sorry, I forgot to add I'm coding in C#...
>>
>> nvx
>>
>>
>> nvx napsal(a):
>