P
Prasun
Hello:
I am trying to handle exceptions in my code. Here the the code i have
Code:
Dim XLFileConn As New OleDbConnection 'New OleDbConnection object
XLFileConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & filename & _
";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1""" 'New connection
string
Try
Try
XLFileConn.Open() 'Open a connection to the choosen Excel
file
Catch ex As Exception 'Code to detect and handle an exception
generated by a connection error
MessageBox.Show("Connection to File Failed - Invalid File,
File type or Path was chosen.", "File Connection Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error) 'If error
occurs - Display message box alerting user about the error
Exit Sub 'Exit Sub-Routine
End Try
I have built the file including the installer and stuff. I run the program
and try to test the error handling by inputing a pdf file instead of an
excel file, It gives me my message box and after i click OK, it then gives
me a default exception handling dialog box and it gives me a quit or
continue option. Do i need to clear some kind of error flag?
Thank You
Prasun
I am trying to handle exceptions in my code. Here the the code i have
Code:
Dim XLFileConn As New OleDbConnection 'New OleDbConnection object
XLFileConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & filename & _
";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1""" 'New connection
string
Try
Try
XLFileConn.Open() 'Open a connection to the choosen Excel
file
Catch ex As Exception 'Code to detect and handle an exception
generated by a connection error
MessageBox.Show("Connection to File Failed - Invalid File,
File type or Path was chosen.", "File Connection Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error) 'If error
occurs - Display message box alerting user about the error
Exit Sub 'Exit Sub-Routine
End Try
I have built the file including the installer and stuff. I run the program
and try to test the error handling by inputing a pdf file instead of an
excel file, It gives me my message box and after i click OK, it then gives
me a default exception handling dialog box and it gives me a quit or
continue option. Do i need to clear some kind of error flag?
Thank You
Prasun