The variable '<variablename>' hides the variable in the closing block
When copying and pasting a piece of code from MSDN, I came up with an error in the header - Variable '' hides the variable in the closing block ,
Everything I copied was a very simple example of a try loop.
As stated in the sentence, βThe common cause of this error is the use of Catch e As Exception inside the event handler. If so, name the block variable Catch ex, not e.β A.
So, I did this, changed both eto ex, and it worked, however, I donβt understand why this is not causing the same error.
Can someone please better explain what the error is, and why e causes it, but ex does not?
edit -
sample code ...
Try
Catch e As Exception
msgbox(e.Message)
End Try
.
Try
Catch ex As Exception
msgbox(ex.Message)
End Try
, , - , , - , ... , - , , . , , .
+3