I don't think there is a way to have the datagrid reverse rows and collumns,
but what you can do is loop through your dataset and create a new dataset
with the rows and columns reversed.
This function will tkae a datatable and turn the rows into columns and the
columns into rows.
Where dattbl1 is your original datatable...
dim dattbl2 as datatable
dattbl2 = ReverseTable(dattbl1)
DataGrid2.DataSource = dattbl2
Private Function ReverseTable(ByVal dattbl1 As DataTable) As DataTable
Dim i, x As Integer
Dim strDummy As String = ""
Dim datTableOut As New DataTable
Dim dr As DataRow
datTableOut.Columns.Add("ColumnName", strDummy.GetType)
For i = 0 To dattbl1.Rows.Count - 1
datTableOut.Columns.Add("Column" & i, strDummy.GetType)
Next
For i = 0 To dattbl1.Columns.Count - 1
dr = datTableOut.NewRow()
dr("ColumnName") = dattbl1.Columns(i).ColumnName
For x = 0 To dattbl1.Rows.Count - 1
dr("Column" & x) = dattbl1.Rows(x).Item(i)
Next
datTableOut.Rows.Add(dr)
Next
Return datTableOut
End Function
"Szaki" <lj**@gazeta.pl> wrote in message
news:dk**********@inews.gazeta.pl...
Hi,
I have a problem with dataGrid. I have a query to database and it returns
me to datagrid, something like this:
--------------------
| Name | Class |
|BBBBB| 2 |
|aaa | 5 |
--------------------
Can i like make it to format such as
______________________
|Name | BBBBB| aaaaaaa |
|Class | 2 | 5 |
-------------------------------
Please adivce....
Mayby somebody have some code in VB. NET or some example apllication with
code.Please send me ... if you want ofcourse.
My e-mial: lj*****@o2.pl
Thanks Luk
--
Pozdrawiam Łukasz