If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Big program for sweaty menu's

Dim MenuOption As String
Dim ThisTextString, teamchoice, townchoice As String
'Boolean = true or false. Setflag will be false until a match is made
Dim setflag As Boolean

Console.WriteLine("This program allows you to access the contact details for a football team")
Console.WriteLine("You can choose to search by team name or town")
Console.WriteLine()
Console.WriteLine()
Do
'find out if user wants to search by team name or town
Console.WriteLine("1. Search by team name")
Console.WriteLine("2. Search by town name ")
Console.WriteLine("3. End program ")

MenuOption = Console.ReadLine
If IsNumeric(MenuOption) And Asc(MenuOption) < 52 And Asc(MenuOption) > 48 Then
Console.WriteLine("Directing you to your option")
Console.ReadLine()
Else
Console.WriteLine("Invalid choice entered, enter a correct option")
Console.ReadLine()
End If
Loop Until Asc(MenuOption) < 52 And Asc(MenuOption) > 48
Select Case MenuOption
'search by team name
Case 1
Do
Console.WriteLine("Enter the team name")
teamchoice = Console.ReadLine
If 65 < Asc(teamchoice) And Asc(teamchoice) < 90 Then
Console.WriteLine("Correct Data Entered your details will be displayed")
Else
Console.WriteLine("Please enter a correct team name")
End If
Loop Until 65 < Asc(teamchoice) And Asc(teamchoice) < 90

'similar to case 1
setflag = False
FileOpen(1, "TeamdataFile.txt", OpenMode.Input)
Do
ThisTextString = LineInput(1)
If InStr(ThisTextString.ToLower, townchoice.ToLower) <> 0 Then
Console.WriteLine("Team: " & ThisTextString)
setflag = True
' at least one team found
End If
Loop Until EOF(1)
FileClose(1)
If setflag = False Then
'display a message if team not found
Console.WriteLine("No teams found in " & townchoice)
End If

Case 3
Console.WriteLine("Program ending............")

End Select

'needed to make program pause & let output be seen on screen
Console.ReadLine()