**** Merged from MCS ****
[mono-project.git] / mcs / mbas / Test / errors / WithStatementC2.vb
blob409cee872363089b2c0b29b0fcfc56560f8cd4e0
1 REM LineNo: 21
2 REM ExpectedError: BC30756
3 REM ErrorMessage: 'GoTo labelA' is not valid because 'labelA' is inside a 'With' statement
4 REM that does not contain this statement.
6 Imports System
8 Module WithStatementC2
9 Class C1
10 Public a1 As Integer = 10
11 Public a2 As String = "Hello"
12 Sub f1()
13 Console.WriteLine("Class C1: {0} {1}", a1, a2)
14 End Sub
15 End Class
17 Sub main()
18 Dim a As New C1()
20 If a.a1 <> 10 Then
21 GoTo labelA
22 End If
24 With a
25 .a1 = 20
26 labelA:
27 .a2 = "Hello World"
28 .f1()
29 End With
31 End Sub
33 End Module