Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As _
             System.EventArgs) Handles btnCalc.Click
  Dim MyVariable As Integer

  MyVariable = 10     ' zmienna istnieje tutaj…

End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As _
             System.EventArgs) Handles btnExit.Click
  Dim MyVariable As Integer    

  MyVariable = 20    ' …a inna zmienna istnieje tutaj
  Me.Dispose()

End Sub
