Iam trying to populate a listbox with values read in from a flat text file in this sequence
AA
AB
AC
AD
AE
and so on at least until I get to EZ
The code is suoppoed to add numbers to these string values so I should see
AA01
AA02
AA03
and when I get to AA99
the next value comes up AB01, AB02, AB03 and so on
but my loop seems to be giving me AA01 then AA0102 and AA010203
Here is my code below I know this is something simple can someone please help ? keep in mind I have not gotten to the part wherre the values AA TO AB must change when it goes past 99.
AA
AB
AC
AD
AE
and so on at least until I get to EZ
The code is suoppoed to add numbers to these string values so I should see
AA01
AA02
AA03
and when I get to AA99
the next value comes up AB01, AB02, AB03 and so on
but my loop seems to be giving me AA01 then AA0102 and AA010203
Here is my code below I know this is something simple can someone please help ? keep in mind I have not gotten to the part wherre the values AA TO AB must change when it goes past 99.
Code:
Public Class Form1
Dim FILE_NAME As String = "C:\Documents and Settings\V-M\Desktop\char_file.txt"
Dim TextLine As String
Dim Prefix As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Dim sb As New System.Text.StringBuilder
Prefix = objReader.ReadLine
For i = 1 To 99
Do While objReader.Peek() <> -1
Dim strint = i.ToString
If i.ToString.Length <= 2 Then
Prefix = Prefix & "0" & i.ToString
ListBox1.Items.Add(Prefix)
Else
Prefix = Prefix & i
End If
i = 1 + i
Loop
Next
End If
End Sub
End Class