Results 1 to 4 of 4

Thread: Error on DataGridview

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    165

    Error on DataGridview

    Hello, I am encountering this error on the DataGrodVeiw:

    "The following exception occurred in the DataGridView:
    System.indexoutofrangeexception: index 0 does not have a value.
    at system.windows.form.currencymanager.get_item(Int32 index)
    at system.windows.forms.datagridviewdataconnection.geterror(Int32 rowindex)

    To replace this default dialog please handle the dataerror event"


    Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Error on DataGridview

    And what exactly did you do to generate that error?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: Error on DataGridview

    I've found this code to solve problems in most cases...

    Code:
    Private Sub Grid_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles Grid.DataError
            If Disposing Then
                e.ThrowException = False
    
            Else
                MsgBox("Rij " & e.RowIndex & " Kolom " & e.ColumnIndex & " Melding " & e.Exception.Message)
            End If
    
        End Sub
    These errors can occur on Disposing a grid due to some handlers like RowChanged being still being handled
    Another way of course is to check on Disposing in all the events you handle on this grid.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Posts
    165

    Re: Error on DataGridview

    Hello,

    I am encountering this error when the focus is set to a cell in the Datagridview and in my code i have cellendedit function so does it affect?

    Thank you
    Hiba

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