multiple datarow on same horizontal row in datagrid

  • Thread starter Thread starter Franz
  • Start date Start date
F

Franz

I am using Windows Form DataGrid. It can show a single DataRow on a single
horizontal row.
However, this leaves much unused empty space.
Therefore, I want to show multiple DataRow on a single horizontal row in
DataGrid.
Is there any method?
Thank you.
 
I may describe it badly. Let me show some real example.
Example ( 0 is the wasted space )
Original :
11110000
22220000
33330000
44440000

What I want is :
11112222
33334444

Alvin Bruney said:
Did you re-read your question before posting?


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Franz said:
I am using Windows Form DataGrid. It can show a single DataRow on a single
horizontal row.
However, this leaves much unused empty space.
Therefore, I want to show multiple DataRow on a single horizontal row in
DataGrid.
Is there any method?
Thank you.
 
this is no easy feat. may i ask why you need this?

one solution is to do it from the underlying dataset since it is difficult
to do so in the binding event since you do not have all the rows. so you
would loop thru your dataset or whatever it is you bind to and, for each
row, copy items 1 thru x into the current row. then remove the following
row.

roughly
for (1 to number of rows)
{
if(rows % 2 == 0) //only process even rows
{
for(1 to number of columns - # of empty cells)
{
ds.tables[0].rows[rows][number of columns - # of empty cells] =
ds.tables[0].rows + 1][columns].tostring();
}
else
ds.tables[0].rows[row].remove();
}

the only guarantee i can make is that this code will contain some bugs.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Franz said:
I may describe it badly. Let me show some real example.
Example ( 0 is the wasted space )
Original :
11110000
22220000
33330000
44440000

What I want is :
11112222
33334444

Alvin Bruney said:
Did you re-read your question before posting?


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Franz said:
I am using Windows Form DataGrid. It can show a single DataRow on a single
horizontal row.
However, this leaves much unused empty space.
Therefore, I want to show multiple DataRow on a single horizontal row
in
DataGrid.
Is there any method?
Thank you.
 
My form can be resized.
However, the size of each row will not be changed.
A large piece of space is wasted.
The reason sounds weird , doesn't it? :-)

Alvin Bruney said:
this is no easy feat. may i ask why you need this?

one solution is to do it from the underlying dataset since it is difficult
to do so in the binding event since you do not have all the rows. so you
would loop thru your dataset or whatever it is you bind to and, for each
row, copy items 1 thru x into the current row. then remove the following
row.

roughly
for (1 to number of rows)
{
if(rows % 2 == 0) //only process even rows
{
for(1 to number of columns - # of empty cells)
{
ds.tables[0].rows[rows][number of columns - # of empty cells] =
ds.tables[0].rows + 1][columns].tostring();
}
else
ds.tables[0].rows[row].remove();
}

the only guarantee i can make is that this code will contain some bugs.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Franz said:
I may describe it badly. Let me show some real example.
Example ( 0 is the wasted space )
Original :
11110000
22220000
33330000
44440000

What I want is :
11112222
33334444

Alvin Bruney said:
Did you re-read your question before posting?


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
I am using Windows Form DataGrid. It can show a single DataRow on a single
horizontal row.
However, this leaves much unused empty space.
Therefore, I want to show multiple DataRow on a single horizontal row
in
DataGrid.
Is there any method?
Thank you.
 
Back
Top