Hydrotronics

Text utils for visual basic

Jan 22nd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. Class Textutils
  2.  
  3. Shared Function Type(ByVal text As String)
  4. For Each cha As String In text
  5. Console.Write(cha)
  6. Threading.Thread.Sleep(20)
  7. Next
  8. Return True
  9. End Function
  10.  
  11. Shared Function Type(ByVal text As String, ByVal speed As Integer)
  12. For Each cha As String In text
  13. Console.Write(cha)
  14. Threading.Thread.Sleep(speed)
  15. Next
  16. Return True
  17. End Function
  18.  
  19. Shared Function TypeArray(ByVal text As Array)
  20. Dim ypos = Console.CursorTop
  21. Dim max = 0
  22. For Each line In text
  23. max = Math.Max(max, line.length)
  24. Next
  25. For i = 0 To max - 1
  26. For Each line In text
  27. Try
  28. Console.Write(line.substring(i, 1))
  29. Catch ex As Exception
  30. Console.Write("")
  31. End Try
  32. Console.CursorTop += 1
  33. Console.CursorLeft = i
  34. Next
  35. Console.CursorTop = ypos
  36. Console.CursorLeft = i + 1
  37. Next
  38. Return True
  39. End Function
  40.  
  41. Shared Function TypeArray(ByVal text As Array, ByVal speed As Integer)
  42. Dim ypos = Console.CursorTop
  43. Dim max = 0
  44. For Each line In text
  45. max = Math.Max(max, line.length)
  46. Next
  47. For i = 0 To max - 1
  48. Threading.Thread.Sleep(speed)
  49. For Each line In text
  50. Try
  51. Console.Write(line.substring(i, 1))
  52. Catch ex As Exception
  53. Console.Write("")
  54. End Try
  55. Console.CursorTop += 1
  56. Console.CursorLeft = i
  57. Next
  58. Console.CursorTop = ypos
  59. Console.CursorLeft = i + 1
  60. Next
  61. Return True
  62. End Function
  63. End Class
Advertisement
Add Comment
Please, Sign In to add comment