|
-
Sep 1st, 2022, 01:06 PM
#1
Thread Starter
New Member
Need Variable Label in GOTO Label statement and/or alternative to GOTO Label.
Hi, I have a sequence of Math Expressions (say from 1 to 10), which are interdependent. Based on condition, I need to start the working from different start positions (i.e. Line numbers) e.g. in case 0 - Expression 1 to 10 must be solved, in Case 4 - expression 4 to 10 must be solved and so on).
I tried following code but failed due to challenge that "Label in GOTO Label statement can not be variable"
May anyone suggest a solution?
Private Sub XYZ(sender As Object, e As EventArgs) Handles SOME handle
Dim ABCD As Integer = 0
Select Case ABCD
Case 0
CallLineCalculations(1, "G0")
Case 4
CallLineCalculations(1, "G4")
Case 5
CallLineCalculations(1, "G5")
End Select
End Sub
Private Sub CallLineCalculations(ByVal nRow As Integer, ByVal gotoLable As String)
GoTo gotolable
G0:
DGVItemDetail(8, nRow).Value = Val(DGVItemDetail(6, nRow).Value) * Val(DGVItemDetail(7, nRow).Value) / 100
DGVItemDetail(9, nRow).Value = Val(DGVItemDetail(6, nRow).Value) - DGVItemDetail(8, nRow).Value
G4:
DGVItemDetail(10, nRow).Value = DGVItemDetail(4, nRow).Value * DGVItemDetail(9, nRow).Value
G5:
DGVItemDetail(12, nRow).Value = DGVItemDetail(10, nRow).Value * DGVItemDetail(11, nRow).Value / 100
DGVItemDetail(13, nRow).Value = DGVItemDetail(10, nRow).Value + DGVItemDetail(12, nRow).Value
...
...
...
...
...
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|