Write a program that requests a color as input in a text box and then determines whether or not the color is in the text file. The program should use the Boolean-valued Function procedure IsCrayola that returns the value True if the color in the text box is a Crayola color.
Here is my code:
Public Class Form1
Dim colors() As String = IO.File.ReadAllLines("colors.txt")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then MessageBox.Show("No color!") 'Input validation!
If IsCrayola() = 1 Then MessageBox.Show("Color Found") Else MessageBox.Show("Not Found")
End Sub
Function IsCrayola(ByVal colors As String) As Boolean
Dim FindString As String = TextBox1.Text
For Each Str As String In colors
If Str.Contains(FindString) Then
Return CBool(1)
End If
Next
End Function
End Class
What am I missing? Thanks!

New Topic/Question
Reply



MultiQuote







|