BEGIN Set Index to 0 Prompt User for ‘SearchItem’ Get ‘Num’ Found = False While Index < 7 and Found = False IF ‘SearchItem’ = ‘Num’ THEN Found = True ELSE Found = False ENDIF Increment Index ENDWHILE IF Found = True THEN Display "Match Found – Num’" ELSE Display "Match not Found" END
Public Class Form1 Dim Name(7) As String Dim Number(7) As Integer Dim Index1 As Integer Dim LastIndex1 As Double Dim SearchItem As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click If txtName.Text = "" Then MsgBox("Enter a name") ElseIf txtNumber.Text = "" Then MsgBox("Enter a Number") ElseIf txtNumber.Text = "" And txtName.Text = "" Then MsgBox("Enter a name and corresponding number") ElseIf Index1 = 7 Then MsgBox("Maximum data entered, reset for additional input") txtName.Clear() txtNumber.Clear() Else Index1 = Index1 + 1 Name(Index1) = txtName.Text Double.TryParse(txtNumber.Text, Number(Index1)) For i = LastIndex1 + 1 To Index1 NameArray.Items.Add(Name(i)) NumberArray.Items.Add(Number(i)) Next i LastIndex1 = Index1 End If txtName.Clear() txtNumber.Clear() End Sub Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click SearchItem = txtSearchItem.Text End Sub End Class
Found
WHILE Index < 7 and SearchItem <> Num Increment Index ENDWHILE IF Index < 7 THEN Display "Match Found – Num" ELSE Display "Match not Found" END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)