Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Main()
- Dim numberOfOptions As Integer
- Dim menuTitleInput As String
- Console.WriteLine("What is the menu title?")
- menuTitleInput = Console.ReadLine()
- Console.WriteLine("How many options are there?")
- numberOfOptions = Console.ReadLine()
- ' asks the user how many options there are and then creates an array with x amount of options'
- Dim options(numberOfOptions - 1) As String
- 'a for loop for the user to enter the options'
- For i = 0 To numberOfOptions - 1
- Console.WriteLine("What is option " & i + 1)
- options(i) = Console.ReadLine()
- Next
- Dim lengthOfBox As Integer
- Dim max As Integer = 0
- For x = 0 To numberOfOptions - 2
- If options(x).Length > max Then ' finds out how long the longest string is
- max = options(x).Length
- End If
- Next
- If menuTitleInput.Length > max Then
- max = menuTitleInput.Length
- End If
- lengthOfBox = max
- Console.Write("+") 'The code to the left '
- For x = 1 To lengthOfBox + 4 'creates the topborder'
- Console.Write("=") '''''''''''''''''''''''
- Next
- Console.Write("+")
- Dim halfLength As Integer = lengthOfBox / 4
- Console.WriteLine("")
- menuTitle(menuTitleInput, halfLength, lengthOfBox) 'goes to the sub called menu and runs it through
- For x = 0 To numberOfOptions - 1
- Console.WriteLine("")
- Console.Write("| " & x + 1 & ". " & options(x)) 'Prints out the options and the option numbers'
- For i = 1 To lengthOfBox - options(x).Length
- Console.Write(" ")
- Next
- Console.Write("|")
- Next
- Console.WriteLine("")
- Console.Write("+") 'The code to the left '
- For x = 1 To lengthOfBox + 4 'creates the bottom border'
- Console.Write("=") '''''''''''''''''''''''
- Next
- Console.Write("+")
- Console.WriteLine("")
- Dim optionSelected As Integer
- Console.WriteLine("Please select an option...")
- optionSelected = Console.ReadLine()
- Console.WriteLine("You have chosen this option: " & options(optionSelected - 1)) 'writes the option selected'
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement