C# DataGridView DataError Event Not Triggering

Joined
Sep 7, 2017
Messages
10
I'm sorry if this is the wrong place to be posting this, it seemed like the right forum for it.

I am trying to make a prototype program to connect to a MySQL database with C# but some of the tables contain invalid data.

When I run the program I keep getting the default DataError message. I have tried adding in this code to handle the error event:

Code:
        private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs anError)
        {
            anError.Cancel = true;
        }

That however doesn't work and I still get the default DataError message when it reaches the part of the table with the data. If anyone could help, I would really appreciate it, thanks.
 

Raithlin

Executive Member
Joined
Jan 4, 2005
Messages
5,032
Can you not handle the invalid data in your SQL query? This just seems like the wrong way to go about it. #justsaying
 
Joined
Sep 7, 2017
Messages
10
I have tried to, its varbinary data, and I have been unable to find a way to either skip the column or for C# to display the data without giving an error. I'm still pretty new to this, so sorry if I am missing something obvious >.<
 

Spacerat

Expert Member
Joined
Jul 29, 2015
Messages
1,036
I have tried to, its varbinary data, and I have been unable to find a way to either skip the column or for C# to display the data without giving an error. I'm still pretty new to this, so sorry if I am missing something obvious >.<

You mean you want to exclude that column from the grid? If so then just exclude the column for the SELECT
 

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
20,107
Just do what I do, wait for the app to go down in a ball of flames, then just restart it.

Edit: You guys have no sense of humor! :whistling:
 
Last edited:
Top