I want to make a empty row between the items in DataGridView
I used this code to show the data in DataGridView and it show me as it show in the pic in Table1. I want to make the data shows each collection same items alone. Asit show in pic in Table2. with empty row between them.
vb Code:
Dim sql As String = " SELECT B,C,D,E,F,G FROM Table1 ORDER BY B "
Re: I want to make a empty row between the items in DataGridView
You can hack it by looping thru the datatable and testing the value of column B for changes. If a change occurs, insert a blank row to the table. When done, bind the table to your DGV...
However, I would just change the background color of the DGV rows instead of inserting blank rows to the datatable.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it. - Abraham Lincoln -
Re: I want to make a empty row between the items in DataGridView
Of course you can loop the datagridviewrows collection and detect for value changes in specific cells and insert a (blank) datagridviewrow to the DGV where the change occurs. However, your DGV is bound to a datatable thus whatever changes made in it will go into the datatable also, you may better just loop the datatable. Besides, by looping the datatable and inserting blank datarows to it, you can set the rows state to unchanged so when it's time to update your database, those blank rows won't get inserted into your database table.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it. - Abraham Lincoln -
Re: I want to make a empty row between the items in DataGridView
I treid this code But it show me this error:
"Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound".