Results 1 to 2 of 2

Thread: [RESOLVED] VB.Net 2005 - Error trying to format DGV???

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Resolved [RESOLVED] VB.Net 2005 - Error trying to format DGV???

    I keep getting the error message:

    "Index was out of range. Must be non-negative and less that the size of the collection".

    What's weird is...I do the exact same thing with several other DGV's and no problems there. Anyway, here is my code:
    Code:
        grd3.DataSource = dsAttachments.Tables(0).Rows
        FormatGrid3()
        '
        '
        '
        Private Sub FormatGrid3()
            Try
                grd3.RowHeadersVisible = False
    
                grd3.Columns(0).Width = 100
                grd3.Columns(0).HeaderText = "Request ID"
    
                grd3.Columns(1).Width = 140
                grd3.Columns(1).HeaderText = "Image Name"
    
                grd3.Columns(2).Width = 430
                grd3.Columns(2).HeaderText = "File Path"
    
            Catch ex As Exception
                strProcedure = "FormatGrid3()"
                Msg = ex.Message
                ErrorHandler(strModule, strProcedure, Msg)
            End Try
        End Sub
    This error message occurs on the 1st line of the FormatGrid3() Sub and I just can't figure out what's causing it. I've compared the grid with other grids in my app and they're exactly the same...properties and all.

    Thanks,
    Blake

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: VB.Net 2005 - Error trying to format DGV???

    I figured it out. I missed seeing something!
    Blake

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