|
-
Sep 21st, 2015, 07:44 PM
#7
Re: What is the fast way to remove ALL rows in DataGridView
 Originally Posted by larrycav
The reason I want to get rid of that row is because of my SAVE button code. I hand potential user errors in the data saving process with this code. This is the section dealing with the DGV. What it doesn't handle is a situation where the user may decide to clear the grid and for God only knows why....then hit the save button, which I do not want them doing if the grid is empty....but you just know someone will do that very thing...
Code:
If DGV1.RowCount < (1) And TBoxFlowTestsCustID.Text < 1 Then
MessageBox.Show("No Captured Flow Data To Save & Customer Data Is Incomplete", _
"C&D Data Archive Process", _
MessageBoxButtons.OK, MessageBoxIcon.None)
Exit Sub
End If
If DGV1.RowCount < (1) Then
MessageBox.Show("No Captured Flow Data To Save", _
"C&D Data Archive Process", _
MessageBoxButtons.OK, MessageBoxIcon.None)
Exit Sub
End If
And it's within reason that they may want to save data with only 1 row in the DGV....so that's why its <1
Removing the data entry row seems misguided to me. For one thing, you could just bind the grid and then use the data source to determine whether there is data to save. Even if the grid isn't bound, you can simply test for the presence of rows where IsNewRow is False.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|