Results 1 to 3 of 3

Thread: [RESOLVED] Which Exception to Use?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Somewhere else today
    Posts
    355

    Resolved [RESOLVED] Which Exception to Use?

    I understand the error message, but I am not sure which exception to use as I want to generate my own error message.

    Code:
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
            
            Try
                Me.Validate()
    
                If RoomSetup.Focus Then
                    Me.RoomCodesBindingSource.EndEdit()
                    Me.RoomCodesTableAdapter.Update(Me.RestelDataSet.RoomCodes)
                End If
    
                If Accounts.Focus Then
                    Me.BudgetTypesBindingSource.EndEdit()
                    Me.BudgetTypesTableAdapter.Update(Me.RestelDataSet.BudgetTypes)
                 End If
    
            Catch ex As System.Data.ConstraintException
                MsgBox("My Own Message of some sort")
    
            End Try
        End Sub
    As you can see I am using an exception but it seems not to be the correct one as I get the message attached not the one I want.

    Any help would be appreciated.

    Computerman
    Attached Images Attached Images  
    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
  •  



Click Here to Expand Forum to Full Width