CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Code Debug

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    Code Debug

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Code Debug

    If you're always adding a record, you could use this:
    Code:
    For irow = 0 To DgvQuarCommit.Rows.Count - 2
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2009
    Posts
    192

    Re: Code Debug

    Thanks
    Worked perfectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured