Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

    setflag = False

    FileOpen(1, "TeamdataFile.txt", OpenMode.Input)
    Do
    ThisTextString = LineInput(1)

    If InStr(ThisTextString.ToLower, teamchoice.ToLower) <> 0 Then
    setflag = True
    End If

    Loop Until EOF(1) Or InStr(ThisTextString.ToLower, teamchoice.ToLower)
    FileClose(1)

    If setflag = True Then
    Console.WriteLine("Contact details: " & ThisTextString)

    Else

    Console.WriteLine("Team not found")
    End If

    Console.ReadLine()


    Case 2
    Console.WriteLine("Enter the town name")
    townchoice = Console.ReadLine

    '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()

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,695
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    *** THIS IS IN THE WRONG FORUM ***

    DIM in JAVA? Come on, moderators!

    This is VB6 code. Uglier than pig snot VB6 code, but still VB6. ANCIENT HISTORY!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Lols.
    I use vb6 all the times(ish). Stupid Access and Excel :]
    Moving to Mysql forum
    J/k, moving to computer programming.

    For the OP, what's the question attached here?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •