BC30616: Variable '<variablename>' hides a variable in an enclosing block
A variable enclosed in a block has the same name as another local variable.
Error ID: BC30616
To correct this error
Rename the variable in the enclosed block so that it is not the same as any other local variables. For example:
Dim a, b, x As Integer If a = b Then Dim y As Integer = 20 ' Uniquely named block variable. End If
A common cause for this error is the use of
Catch e As Exception
inside an event handler. If this is the case, name theCatch
block variableex
rather thane
.Another common source of this error is an attempt to access a local variable declared within a
Try
block in a separateCatch
block. To correct this, declare the variable outside theTry...Catch...Finally
structure.
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for