0

I would like to have a DataGridView with ComboBoxes as Headers. The DGV always has 2 columns. I need the comboBoxes in order to select the unit that the values I fill in are (e.g. first column is going to be sec, min, hr).

I did look up and try the version used at the following entries: MSDN and Stack Overflow (basically the same solution)

Yet I would like the Cell to act just like a ordinary DataGridViewComboBoxCell, which I use at antoher part of my code

        DataGridViewComboBoxCell sensor = new DataGridViewComboBoxCell();
        sensor.DataSource = new String[] { "Kein Sensor", "KTY84", "PTC", "PT1000" };
        engineDataGrid.Rows[10].Cells["value"] = sensor;
        engineDataGrid.Rows[10].Cells["value"].Value = sensor.Items[0];

How can I merge my ordinary Versionen with the Column Headers?

TaW
  • 53,122
  • 8
  • 69
  • 111
Martin
  • 25
  • 7
  • 1
    _Yet I would like the Cell to act just like a ordinary DataGridViewComboBoxCell_ Um, as opposed to what about the solution in the links? Please explain in detail what you miss or can't use there! – TaW Jul 24 '18 at 14:55
  • @TaW Thank you for your help, though I was already able to find a solution, the other solution just looks like I took a comboBox and dragged it in front of the dgv, also, It doesn't change it's size if the column size is changed. If I just made a mistake upon implementation that you can point out rather easy, I'd like to year it though – Martin Jul 25 '18 at 06:58
  • @Martin Please make sure you update your post with the answer you found so that future readers have access to your solution. You can always answer your own questions as well. – Hazel へいぜる Jul 30 '18 at 22:45
  • @davisj1691 Thanks for the reminder, wanted to do so but forgot about it. Just entered the solution I used. – Martin Aug 01 '18 at 10:37

1 Answers1

0

The solution I ended up using is a work around, disabling the column header and using the first row as my header, editing it the way I posted with the question. A bit of editing with the border style and it looks just like it is the original header or to be more precise, a style for the header i like for the application, but as a combobox.

Martin
  • 25
  • 7