Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. Sub Main()
  2. Dim numberOfOptions As Integer
  3. Dim menuTitleInput As String
  4. Console.WriteLine("What is the menu title?")
  5. menuTitleInput = Console.ReadLine()
  6. Console.WriteLine("How many options are there?")
  7. numberOfOptions = Console.ReadLine()
  8. ' asks the user how many options there are and then creates an array with x amount of options'
  9. Dim options(numberOfOptions - 1) As String
  10. 'a for loop for the user to enter the options'
  11. For i = 0 To numberOfOptions - 1
  12. Console.WriteLine("What is option " & i + 1)
  13. options(i) = Console.ReadLine()
  14. Next
  15. Dim lengthOfBox As Integer
  16. Dim max As Integer = 0
  17. For x = 0 To numberOfOptions - 2
  18. If options(x).Length > max Then ' finds out how long the longest string is
  19. max = options(x).Length
  20. End If
  21. Next
  22. If menuTitleInput.Length > max Then
  23. max = menuTitleInput.Length
  24. End If
  25. lengthOfBox = max
  26. Console.Write("+") 'The code to the left '
  27. For x = 1 To lengthOfBox + 4 'creates the topborder'
  28. Console.Write("=") '''''''''''''''''''''''
  29. Next
  30. Console.Write("+")
  31. Dim halfLength As Integer = lengthOfBox / 4
  32. Console.WriteLine("")
  33. menuTitle(menuTitleInput, halfLength, lengthOfBox) 'goes to the sub called menu and runs it through
  34. For x = 0 To numberOfOptions - 1
  35. Console.WriteLine("")
  36. Console.Write("| " & x + 1 & ". " & options(x)) 'Prints out the options and the option numbers'
  37. For i = 1 To lengthOfBox - options(x).Length
  38. Console.Write(" ")
  39. Next
  40. Console.Write("|")
  41. Next
  42. Console.WriteLine("")
  43. Console.Write("+") 'The code to the left '
  44. For x = 1 To lengthOfBox + 4 'creates the bottom border'
  45. Console.Write("=") '''''''''''''''''''''''
  46. Next
  47. Console.Write("+")
  48. Console.WriteLine("")
  49. Dim optionSelected As Integer
  50. Console.WriteLine("Please select an option...")
  51. optionSelected = Console.ReadLine()
  52. Console.WriteLine("You have chosen this option: " & options(optionSelected - 1)) 'writes the option selected'
  53. Console.ReadLine()
  54. End Sub
  55.  
  56. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement