|
-
Sep 5th, 2009, 04:48 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Which Exception to Use?
It was much easier in VB6, but I am now liking Vb.Net alot more. 
-
Sep 5th, 2009, 04:56 PM
#2
Re: Which Exception to Use?
The key is the last sentence of the error message. You have to handle the DataError event on the grid.
Private Sub DataGridView1_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
If TypeOf (e.Exception) Is System.Data.ConstraintException Then
MsgBox("My Own Message of some sort")
'tell the grid you handled this error
e.Cancel = True
End If
End Sub
Last edited by Edneeis; Sep 5th, 2009 at 05:02 PM.
-
Sep 5th, 2009, 05:00 PM
#3
Thread Starter
Hyperactive Member
Re: Which Exception to Use?
Many thanks for that. I works perfectly.
Computerman
It was much easier in VB6, but I am now liking Vb.Net alot more. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|