none
C# Windows Remove 'null' value from DataGrid RRS feed

  • Question

  • Hi Experts,

    I have DataGrid and end user can save multiple rows to DB from Grid.

    Suppose, user fills up 1st row and press enter. Immediately the next row of Grid values shows null for each columns.

    At this time if I trying to save this record, then I will get error as "Index 1 does not have a value."

    How to control such error?

    Thanks.







    "Knowledge Shared Is Knowledge Gained"
    • Moved by edhickey Tuesday, April 27, 2010 4:34 PM more appropriate forum (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Tuesday, April 27, 2010 6:17 AM

Answers

  • Sheng,

    Thanks. Please view it on : http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f304839a-644d-4d53-b26c-ee5ecf2a94fb

    Thanks.

     


    "Knowledge Shared Is Knowledge Gained"
    • Marked as answer by Vijay Jadhav Thursday, April 29, 2010 6:04 AM
    Thursday, April 29, 2010 6:03 AM

All replies

  • Hi Vijay,

      I think this is becasue of sending null values to the DB. If you have a validation before you send to DB, will solve this.

    You have not mentioned the exact scenario i guess. Please add code to datagrid's cell validation event to check the value is null or not.

     


    -- Thanks Ajith R
    Tuesday, April 27, 2010 6:27 AM
  • Ajith,

    Thanks for the reply.

    Any idea, that find out null values of DataGrid?

    Thanks.

     

     


    "Knowledge Shared Is Knowledge Gained"
    Tuesday, April 27, 2010 7:20 AM
  • Try find a forum for the Grid control. E.g. if you are using the DataGridView class in Windows Forms, try the Windows Forms Data Controls forum.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Tuesday, April 27, 2010 5:32 PM
  • Sheng,

    Thanks. Please view it on : http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f304839a-644d-4d53-b26c-ee5ecf2a94fb

    Thanks.

     


    "Knowledge Shared Is Knowledge Gained"
    • Marked as answer by Vijay Jadhav Thursday, April 29, 2010 6:04 AM
    Thursday, April 29, 2010 6:03 AM