E
ECathell
I have an exception that is being caught and handled correctly in my VS IDE. However the compiled version throws an unhandled exception when it reaches that point...here is some code....
this is where the unhandled is being raised:
Try
........
Dim prodcol As New Mountaire.Database.Products.ProductsCollection(mLocation)
prodcol.Add(mNewProduct)
Catch ex As Mountaire.Database.Products.ProductExistsException
Me.Hide()
Me.DialogResult = DialogResult.Cancel
Throw New Mountaire.Database.Products.ProductExistsException
Catch ex As InvalidCastException
MessageBox.Show("You must fill in Pluno and Product Code.", "Invalid Input")
Me.DialogResult = DialogResult.Abort
Finally
End Try
however in the calling code this is what I have:
try
......
dlgResult = frm.ShowDialog
If dlgResult = DialogResult.OK Then
Me.fillProductInformation(mLocation)
index = CInt(frm.txtPluno.Text)
'debug.WriteLine(frm.NewProduct.PluNo)
Else
Throw New Mountaire.GenericException.ActionCanceledException
End If
Loop Until dlgResult <> DialogResult.Abort
Catch ex As Mountaire.GenericException.ActionCanceledException
index = 0
Catch ex As Products.ProductExistsException
MessageBox.Show(ex.Message, "Product Already Exists")
index = CInt(frm.txtPluno.Text)
Catch ex As Exception
MessageBox.Show(ex.ToString, "Exception Thrown")
Finally
Me.mProductCM.Position = mProductCollection.IndexOf(index)
End Try
Any Ideas?
this is where the unhandled is being raised:
Try
........
Dim prodcol As New Mountaire.Database.Products.ProductsCollection(mLocation)
prodcol.Add(mNewProduct)
Catch ex As Mountaire.Database.Products.ProductExistsException
Me.Hide()
Me.DialogResult = DialogResult.Cancel
Throw New Mountaire.Database.Products.ProductExistsException
Catch ex As InvalidCastException
MessageBox.Show("You must fill in Pluno and Product Code.", "Invalid Input")
Me.DialogResult = DialogResult.Abort
Finally
End Try
however in the calling code this is what I have:
try
......
dlgResult = frm.ShowDialog
If dlgResult = DialogResult.OK Then
Me.fillProductInformation(mLocation)
index = CInt(frm.txtPluno.Text)
'debug.WriteLine(frm.NewProduct.PluNo)
Else
Throw New Mountaire.GenericException.ActionCanceledException
End If
Loop Until dlgResult <> DialogResult.Abort
Catch ex As Mountaire.GenericException.ActionCanceledException
index = 0
Catch ex As Products.ProductExistsException
MessageBox.Show(ex.Message, "Product Already Exists")
index = CInt(frm.txtPluno.Text)
Catch ex As Exception
MessageBox.Show(ex.ToString, "Exception Thrown")
Finally
Me.mProductCM.Position = mProductCollection.IndexOf(index)
End Try
Any Ideas?