Empty row in DataGrid

T

tB

Hi!

I have DataGrid with five columns.
DataGrid must have every sixth row empty!

Row 1 = DataItem 1
....
Row 5 = DataItem 5

Row 6 = Empty

Row 7 = DataItem 6


Is it possible to make this, I don't have any idea how to accomplish that??
 
E

Edge

tB said:
Hi!

I have DataGrid with five columns.
DataGrid must have every sixth row empty!

Row 1 = DataItem 1
...
Row 5 = DataItem 5

Row 6 = Empty

Row 7 = DataItem 6


Is it possible to make this, I don't have any idea how to accomplish
that??

It's possible by modifying the data source before binding.

Load your data in a DataSet ds.
Then, use this code (for VB.NET):

Dim i As Integer = 5
While i<ds.Tables(0).Rows.Count
Dim myNewRow As DataRow
' Create an array with 3 elements (1 for every column)
Dim rowVals(2) As Object
rowVals(0) = ""
rowVals(1) = ""
rowVals(2) = ""
' Add and return the new row.
ds.Tables(0).Rows.InsertAt(i,rowVals)
i=i+6
End While

Finally, bind your grid to the DataSet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top