Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to switch rows and columns in a datagridview?
    primarykey
    data
    text
    <p>I have 10 records of data in a DataTable which has 3 fields "Foo", "Bar", and "Baz".</p> <p>If I connect wire this into a DataGridView I see 10 rows and 3 columns, and the column headers display the names of the fields.</p> <p>I'm wondering how easy it is to reverse the rows and columns so that with the same data I end up with 3 rows and 10 columns, with field names being displayed in the row headers.</p> <hr> <p>I can do some things manualy, like overriding an OnPaint method and drawing the field names directly into the row header cells, but I'm looking for something more automated.</p> <p>Again, there's a suggestion of swapping values manualy, but unless I make all values Strings, this isn't going to work. 3 columns in a data table - Foo, Bar, and Baz of types int, float and string just won't transpose.</p> <p>Even if I managed all of these manual changes, my data grids have CheckBox columns, ComboBox columns - no such row counterpart exists - there is no CheckBox row or ComboBox row. Where I currently just need to tell the compiler to "Add a ComboBoxColumn" I'd have to re-write so that every cell was generated individually.</p> <p>Ideally I'd like a TransposableDataGridView which exposed all functionality of the DataGridView, with an additional bool property "Transposed". That way I could leave all of my code exactly as it is - I wouldn't have to change anything except for the type of the grid.</p> <p>If nothing like this exists, I might just have to go and write it. (Should only take me a year or so! :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload