Select Case: need help

bobmack37

Newcomer
Joined
Apr 22, 2003
Messages
12
I am doing a Select Case where I am trying to keep track of the members who have joined club the members go by Bronze, Silver, and Gold I am trying to read them out of the newmembs.txt in order, all bronze the all silver then of coures all gold heres what I got but I am having trouble with what I got, can you look at what I got, Thanks Steve T

Dim vmembers As String
Dim bronze As Integer
Dim silver As Integer
Dim gold As Integer
FileOpen(1, "newmembs.txt", OpenMode.Input)
Do Until EOF(1)
Input(1, vmembers)
Select Case vmembers
Case "bronze"
bronze = 1 + bronze
Case "silver"
silver = 1 + silver
Case "gold"
gold = 1 + gold
Case Else
End Select
Loop
lstout.Items.Add(bronze & silver & gold)
End Sub
End Class
 
Where you have
Visual Basic:
Select Case vmembers
try
Visual Basic:
Select vmembers
Also you really should look at System.IO for doing file handling, it's far superior to the VB6 way of doing things
 
don't worry all I figured it out

Dim vmembers As String
Dim vbronze(1) As String
Dim vsilver(1) As String
Dim vgold(1) As String
Dim vtype As String
Dim bronze As Integer = 1
Dim silver As Integer = 1
Dim gold As Integer = 1
Dim I As Integer
Dim cnt As Integer
FileOpen(1, "newmembs.txt", OpenMode.Input)
Do Until EOF(1)
Input(1, vmembers)
Input(1, vtype)
Select Case vtype
Case "Bronze"
vbronze(bronze) = vmembers
bronze = 1 + bronze
ReDim Preserve vbronze(bronze)
Case "Silver"
vsilver(silver) = vmembers
silver = 1 + silver
ReDim Preserve vsilver(silver)
Case "Gold"
vgold(gold) = vmembers
gold = 1 + gold
ReDim Preserve vgold(gold)
Case Else
End Select
cnt = cnt + 1
Loop
For I = 0 To bronze - 1

lstout.Items.Add(" " & vbronze(I))
Next
For I = 0 To silver - 1
lstout.Items.Add(" " & vsilver(I))
Next
For I = 0 To gold - 1
lstout.Items.Add(" " & vgold(I))
Next
FileClose(1)

End Sub
End Class
 
Back
Top