data grid error message

ebrady

New member
Joined
Mar 29, 2006
Messages
2
Programming Experience
3-5
Hi, I have a data grid bound to a dataset that contains two tables. I've created primary key constraints on the tables to enforce business rules and so when a user types in values that would produce a duplicate key the data grid displays a message indicating that the columns are constrained to be unique. So it's working fine but the problem is that the message displayed automatically by the data grid is not appropriate for the user. I'd like to intercept and customize the message that the data grid displays during this situation. Is this possible?

Thanks in advance.
 
I assume you are using a try/catch block to catch the exception when it is thrown? If so just add a messagebox.show after the catch statement and add whatever info you'd like the user to see in there.
 
No, I'm not using a try/catch block. Where would I put the Try/Catch block? In which event? An event on the data table, data set, or data grid?

After I "wire" the data set to the data grid there is no code around for me to use a try catch block. I mean, the data grid takes care of updating the data table and I get the error when the data grid tries to update the data table (which is does automatically without any code on my part)... and this all happens before the code I wrote to save the data to the database. So I don't see where I'm supposed to use the try/catch.
 
Back
Top