Results 1 to 4 of 4

Thread: [2005] Data grid errors

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    166

    [2005] Data grid errors

    Hi,

    I have a series of data grids in my project.

    Some of the fields in the grids are date and numbers. I don't believe i have assigned these columns as these types so can someone tell me whether the are automatically assigned from the database.

    the validation here is all well and good. However when the user enters an incorrect value, it produces a very large unfriendly message relating the error.

    I can't seem the find where this error message comes from in my code to change it. Can anyone help?

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

    Re: [2005] Data grid errors

    I see that you're using VB 2005. Do you really have a series of DataGrids or do you actually have a series of DataGridViews? The two are quite different so please be clear when posting. If you are using DataGrids then I would question why, because the DataGridView is superior in almost every way. Also, if you are using a DataGridView then that large, unfriendly message tells you what to do to avoid it and provide your own error message.
    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

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    166

    Re: [2005] Datagridview errors

    i see it says to handle the data error event, but i don't know how to do this or where to place it in my code

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

    Re: [2005] Data grid errors

    It's just an event like any other, so you would create the event handler the same way you do any other event handler and you would put in the same place you do any other event handler. To create a handler for an event that is not the default you either use the Properties window and press the Events button or you use the drop-down lists at the top of the code window.

    Once you have the empty method definition you simply add the code to do what you want. Like any event handler the 'e' parameter contains the data for the event. You should read the documentation for the DataGridView.DataError event and see what data that object provides and then decide how best to use it.
    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

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