Click to See Complete Forum and Search --> : Code Debug


dr223
February 26th, 2009, 04:33 AM
Hallo,

I am working with VB.net and have a problem with the below code. This code works well however the problem is it creates another field after the last record and set that field in Column 14 to "YES". I don't ant this to happen

Can anyone modify the code that this should not happen...

Thank you


Dim irow As Integer
For irow = 0 To DgvQuarCommit.Rows.Count - 1

If IsDBNull(DgvQuarCommit.Rows(irow).Cells(1).Value) Then
DgvQuarCommit.Rows(irow).Cells(14).Value = "NO"
Else
DgvQuarCommit.Rows(irow).Cells(14).Value = "YES"
End If

Next irow

dglienna
February 26th, 2009, 08:03 PM
If you're always adding a record, you could use this:

For irow = 0 To DgvQuarCommit.Rows.Count - 2

dr223
February 27th, 2009, 07:29 AM
Thanks
Worked perfectly