Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27412

VS 2010 Validate DGV rows contains "0" value before inserting into Access DB

$
0
0
Dear All,

I am doing an application with DGV to get the user input.
There are five column and n number of rows which user can add, now i want to validate if the user enters 0 (zero quantity) in a particular column in
n number of rows before inserting into access db

Here my code but its not checking entire number of rows even i looped DGV, if 1st row is zero and 2,3,4... rows is 1 or > than zero then its validating and if 1st row is 1 or > than zero and 2,3,4... rows is zero then its going to else part.

Code:


For Each item As DataGridViewRow In Me.DataGridView2.Rows
If item.Cells(3).Value = 0 Then
MsgBox("Zero Qty is not Allowed")
Exit For
Else
' Insert into table Qry
End If
Next


Viewing all articles
Browse latest Browse all 27412

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>