468,272 Members | 2,001 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

DataGridView and comboboxes

Hello

can anyone tell me if its possible to have mixed colum-types inside
one colum in a Datagridview under Net 2.0?

I need to have comboboxes (with different content), inputfields and
DateTimePicker inside one column depending on some flag on the
DataRow.

I am not using databinding.

Any example would be very welcome.

_tia rene

Aug 21 '07 #1
2 1720
In article <11**********************@d55g2000hsg.googlegroups .com>,
ReneMarxis wrote:
can anyone tell me if its possible to have mixed colum-types inside
one colum in a Datagridview under Net 2.0?
Yes, it seems to be as simple as creating a new datagridview cell of
the type you need and assigning it to the desired row and column.
Any example would be very welcome.
This sets the first row to use a combo box cell:

for (int i = 0; i < numColumns; i++)
{
DataGridViewComboBoxCell cbx = new DataGridViewComboBoxCell();
cbx.Items.Add("");
cbx.Value = "";
mainDataGridView.Rows[0].Cells[i] = cbx;
filterBoxes[i] = cbx;
}

Hope this helps

Mike

Aug 27 '07 #2
On 27 Aug., 18:49, Mike Blake-Knox <mik...@community.nospamwrote:
In article <1187703143.672256.142...@d55g2000hsg.googlegroups .com>,

ReneMarxis wrote:
can anyone tell me if its possible to have mixed colum-types inside
one colum in a Datagridview under Net 2.0?

Yes, it seems to be as simple as creating a new datagridview cell of
the type you need and assigning it to the desired row and column.
Any example would be very welcome.

This sets the first row to use a combo box cell:

for (int i = 0; i < numColumns; i++)
{
DataGridViewComboBoxCell cbx = new DataGridViewComboBoxCell();
cbx.Items.Add("");
cbx.Value = "";
mainDataGridView.Rows[0].Cells[i] = cbx;
filterBoxes[i] = cbx;

}

Hope this helps

Mike
WOOT thanks ...... this is very very simple ...... can t understand
why i didn t get this.

many thanks

Sep 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by milk-jam | last post: by
2 posts views Thread by Nathan | last post: by
2 posts views Thread by Ketan Dixit | last post: by
2 posts views Thread by Ketan Dixit | last post: by
3 posts views Thread by =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post: by
OuTCasT
reply views Thread by OuTCasT | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.