Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

On Goto Subitute

$
0
0

I used to use a on goto statement in vb6 but now I need it in VB2012

I need to start in the Middle of a Group of For Next Loops according to the Length of a String

This is Just a FYI Example

Thanks Mike

    Sub InsideLooping()

        Dim LastCount As Integer = 5

        Dim MyString As String = "123"

        Dim StrLen As Integer = Len(MyString)

        'On StrLen Goto Line1, Line2, Line3, Line4, Line5, Line6, Line7

        If StrLen = 0 Then GoTo AllDone

Line7:
        If StrLen < 7 Then GoTo Line6
        For L = 0 To LastCount      'MyString Len = 7

Line6:
            If StrLen < 6 Then GoTo Line5
            For K = 0 To LastCount      'MyString Len = 6

Line5:
                If StrLen < 5 Then GoTo Line4
                For J = 0 To LastCount      'MyString Len = 5

Line4:
                    If StrLen < 4 Then GoTo Line3
                    For I = 0 To LastCount      'MyString Len = 4

Line3:
                        If StrLen < 3 Then GoTo Line2
                        For H = 0 To LastCount      'MyString Len = 3

Line2:
                            If StrLen < 2 Then GoTo Line1
                            For G = 0 To LastCount      'MyString Len = 2

Line1:
                                For F = 0 To LastCount      'MyString Len = 1

                                Next F

                                    If StrLen > 1 Then Next 'G

                            If StrLen > 2 then Next 'H

                        If StrLen > 3 then Next 'I

                        If StrLen > 4 then Next 'J

                    If StrLen > 5 then Next 'K

                If StrLen > 6 then Next 'L

AllDone:

    End Sub


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>