Okay so I am using visual basic as a user interface for my oracle database. I have triggers implemented into oracle already. I want to show that my triggers work in visual basic so I am inserting data that will cause the database to fail and the triggers to be fired up. In visual basic, it just crashes, instead I want a messagebox to display instead of it crashing. How would I do this?
Private Sub TRANSACTIONBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles TRANSACTIONBindingNavigatorSaveItem.Click
Me.Validate()
Me.TRANSACTIONBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DataSet)
the line below this is the one that is it doesn't like
Me.TableAdapterManager.UpdateAll(Me.DataSet)
Here is what I Have now? It doesn't like the word Exception though
Private Sub TRANSACTIONBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles TRANSACTIONBindingNavigatorSaveItem.Click
Me.Validate()
Me.TRANSACTIONBindingSource.EndEdit()
Try
Catch exception
MessageBox.Show("Error", "Error")
End Try
Me.TableAdapterManager.UpdateAll(Me.DataSet)
End Sub
You're doing it wrong, please read the MSDN properly.
Private Sub TRANSACTIONBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TRANSACTIONBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.TRANSACTIONBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DataSet)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub