DataGridView and comboboxes

  • Thread starter Thread starter ReneMarxis
  • Start date Start date
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
 
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
 
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
 
Back
Top