Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form4
  2.  
  3.     Dim Colors(49) As String
  4.  
  5.     Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  6.         ListBox1.Items.Clear()
  7.         For i As Integer = 0 To Colors.Length - 1
  8.             If (Colors(i) IsNot Nothing) Then
  9.                 If (Colors(i).ToLower().StartsWith(TextBox1.Text.ToLower())) Then
  10.                     ListBox1.Items.Add(Colors(i))
  11.                 End If
  12.             End If
  13.         Next
  14.     End Sub
  15.  
  16.  
  17.     Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  18.         Dim count As Integer
  19.         Dim sr As IO.StreamReader = IO.File.OpenText("CRAYONS.TXT")
  20.         Do While (sr.Peek <> -1)
  21.             Colors(count) = sr.ReadLine
  22.             count += 1
  23.             If (count >= Colors.Length) Then
  24.                 ReDim Preserve Colors(Colors.Length + 10)
  25.             End If
  26.         Loop
  27.  
  28.         For i As Integer = 0 To Colors.Length - 1
  29.             If (Colors(i) IsNot Nothing) Then
  30.                 ListBox1.Items.Add(Colors(i))
  31.             End If
  32.         Next
  33.  
  34.     End Sub
  35.  
  36. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement