.NET Programming With Me

VB.NET : Alphanumeric increment

I wanted to generate an alphanumeric value for a number of repeated times. Each time the number and the alphabet should add 1 to their value

For example: 475Y, 476Z, 477A, 478B and so on..

I did it as following:


        Dim alphaNumericNum As String = String.Empty
        Dim number As Integer = 475
        Dim alphabet As String = "Y"
        Dim loopValue as integer = 5



        For index As Integer = 0 To loopValue - 1
            alphaNumericNum = number.ToString & alphabet

            MsgBox("The new Symbol No. is " & alphaNumericNum)
            
            number = number + 1

            If Asc(alphabet) + 1 <= 90 Then
                alphabet = Chr(Asc(alphabet) + 1)
            Else
                alphabet = "A"
            End If

        Next


Source (Zipped file)

No comments: