Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class ColorsForm
'program Colors on page 324. Needs to create an array with upper bound of 50 and then increase the size of the array
' by 10 elements whenever it runs out of space to store the colors.
' Need to figure out how to increase the size of the array when the program is reading a file and runs out of room
Dim Colors(50) As String
Dim reccount As Integer
Private Sub ColorsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer = -1
Dim sr As IO.StreamReader = IO.File.OpenText("c:\DOCUMENTS and Settings\COLORS.txt")
Do While (sr.Peek <> -1)
i += 1
Colors(i) = sr.ReadLine
Loop
sr.Close()
End Sub
Private Sub btnColors_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnColors.click
lstColors.Items.Clear()
For i As Integer = 0 To 50
If (Colors(i).Substring(0, 1) = txtState.Text) Then
lstColors.Items.Add(Colors(i))
End If
Next
End Sub
End Class
2007-11-25
00:21:30
·
1 answers
·
asked by
Tyna
1
in
Computers & Internet
➔ Programming & Design