如何使用其他课程访问goto。第一个代码作为我的第一个类,底部代码是我的第二个类。我想在第二课时使用goto执行class1的行。看看我的代码可能会有人理解我的意思。
的Class1
Next4sides: 'My label here
'MsgBox(ObjectFunction.count)
If ObjectFunction.count = 1 Then
Me.Size = New Size(506, 200)
CreateObject.AddTextBox()
CreateObject.AddLabel()
CreateObject.lbl.Text = "Square"
CreateObject.txtbox.Text = "Enter length side"
CreateObject.txtbox.Name = "txtlengthside"
cmbox.Visible = False
ElseIf ObjectFunction.count = 2 Then
CreateObject.AddTextBox()
CreateObject.AddTwoTextBox()
CreateObject.lbl.Text = "Rectangle"
CreateObject.txtbox.Text = "Enter width"
CreateObject.txtbox.Name = "txtrecwidth"
CreateObject.txtbox1.Text = "Enter height"
CreateObject.txtbox1.Name = "txtrecheight"
End If
我想从此class2
访问标签“Next4sides:”
If count = 1 Then
If (String.Compare(CType(Form1.Controls("txtlengthside"), TextBox).Text, "return", True) <> 0) Then
If e.KeyChar.Equals(Microsoft.VisualBasic.ChrW(Keys.Return)) Then
Shape.setSquare(CType(Form1.Controls("txtlengthside"), TextBox).Text)
MsgBox("Type Return In The Box to Return to main menu" & vbNewLine & vbNewLine & "Answer" & vbNewLine & "Area: " & Shape.getTriangle() & vbNewLine & vbNewLine & "Next is Rectangle")
count = count + 1
CreateObject.txtbox.Dispose()
'FROM THIS LINE I WANT TO ACCESS THE LABEL USING GoTo
End If
Else
Application.Restart()
End If