Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form4
- Dim Colors(49) As String
- Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
- ListBox1.Items.Clear()
- For i As Integer = 0 To Colors.Length - 1
- If (Colors(i) IsNot Nothing) Then
- If (Colors(i).ToLower().StartsWith(TextBox1.Text.ToLower())) Then
- ListBox1.Items.Add(Colors(i))
- End If
- End If
- Next
- End Sub
- Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim count As Integer
- Dim sr As IO.StreamReader = IO.File.OpenText("CRAYONS.TXT")
- Do While (sr.Peek <> -1)
- Colors(count) = sr.ReadLine
- count += 1
- If (count >= Colors.Length) Then
- ReDim Preserve Colors(Colors.Length + 10)
- End If
- Loop
- For i As Integer = 0 To Colors.Length - 1
- If (Colors(i) IsNot Nothing) Then
- ListBox1.Items.Add(Colors(i))
- End If
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement