DataGridView and comboboxes

R

ReneMarxis

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
 
M

Mike Blake-Knox

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 = cbx;
filterBoxes = cbx;
}

Hope this helps

Mike
 
R

ReneMarxis

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 = cbx;
filterBoxes = cbx;

}

Hope this helps

Mike


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

many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top