Is there something similar like "try ... catch" in c++.
Printable View
Is there something similar like "try ... catch" in c++.
Moved to C++ Forum.
Yes! http://msdn.microsoft.com/library/de...statements.aspQuote:
Originally Posted by andrzej
There is nothing like this in VB
VB.NET has the same Try Catch and VB6 has On Error GoTo SomeErrorHandler.
I think moving this thread here was wrong. I think it was a question about VB, if it had a feature that the OP knew from C++.
Can somebody move it back?
I could ... Although I'm still not sure if the original poster is asking if VB has a "try and catch" like in C++ or if C++ has a "try and catch" like in VB(.NET).Quote:
Originally Posted by CornedBee
I have to agree with CornedBee here. I said it to RobDog right after he moved it. I am pretty sure he means "AS in C++".
ØØ
sorry, but I don't know why my question was moved to "C++ Forum". Probably it is my fault, beacuse of my poor english. I mean " try and catch AS IN C++". I am beginner in VB for Application.
Sorry once again, unfortunatelly I don't know how to move this question back to VBA Forum.
Thanks for your help
You can't. Only moderators can do that.Quote:
Originally Posted by andrzej
Anyway, thanks for the clarification, and I hope your question was answered.
My bad :( You know Mods can make a mistake only once a year so I guess I reached my quota for this year. If I make another
one I may be banned. :lol:
Only Sunburnt or a Supermod/Admin can move the thread, but the answer would be the On Error declaration.
VB Code:
Private Sub Command1_Click() On Error GoTo MyError 'Create some error MsgBox 1/0 Exit Sub MyError: If Err.Number = 11 Then MsgBox "Can not divide by zero" Else MsgBox Err.Number & " - " & Err.Description, vbOkOnly + vbExclamation End If End Sub