home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD78987182000.psc / Module1.bas < prev    next >
Encoding:
BASIC Source File  |  2000-07-17  |  1.9 KB  |  96 lines

  1. Attribute VB_Name = "modClient"
  2. Option Explicit
  3. Public strServer As String
  4. Public iPort As Integer
  5. Public strUsername
  6. Public lNameColour As Long
  7. Public lTextColour As Long
  8. Public lVisitorName As Long
  9. Public lVisitorText As Long
  10. Public strCommands(50) As String
  11. Public strTemp(50) As String
  12. Public iArrayIndex As Integer
  13. Public bTimestamp As Boolean
  14. Public lTime As Long
  15. Public bLog As Boolean
  16. Public strLogFile As String
  17.  
  18. Private Sub Main()
  19. frmClientOptions.LoadOptions
  20. frmClient.Show
  21. End Sub
  22.  
  23.  
  24. Public Sub InsertItemToArray(strItem As String)
  25. 'insert strItem into spot 0 of the array and move
  26. 'all the other items down one
  27.  
  28. Dim i As Integer
  29. Dim j As Integer
  30. Dim strTemp(50) As String
  31.  
  32. 'set first item to strItem
  33. strTemp(0) = strItem
  34.  
  35. 'move items up one spot
  36. For i = 1 To 50
  37.     strTemp(i) = strCommands(i - 1)
  38. Next i
  39.  
  40. 'move data back into strCommands array
  41. For i = 0 To 50
  42.     strCommands(i) = strTemp(i)
  43. Next i
  44.  
  45. End Sub
  46.  
  47. Function GetPrevItem() As String
  48. 'get the previous item entered
  49. If iArrayIndex < FindHighestUsedItem - 1 Then
  50.     iArrayIndex = iArrayIndex + 1
  51.     GetPrevItem = strCommands(iArrayIndex)
  52. Else
  53.     GetPrevItem = "*** Beginning of Commands ***"
  54.     iArrayIndex = FindHighestUsedItem
  55. End If
  56. End Function
  57.  
  58. Function FindHighestUsedItem() As Integer
  59.  
  60. 'returns the highest used item in the commands array
  61. Dim i As Integer
  62.  
  63. For i = 0 To 50
  64.     If strCommands(i) = "" Then
  65.         FindHighestUsedItem = i
  66.         i = 51
  67.     End If
  68. Next i
  69.  
  70. If FindHighestUsedItem = 0 Then
  71.     FindHighestUsedItem = 50
  72. End If
  73. End Function
  74.  
  75. Function GetNextItem() As String
  76. 'get the next item in array
  77. If iArrayIndex > 0 Then
  78.     iArrayIndex = iArrayIndex - 1
  79.     GetNextItem = strCommands(iArrayIndex)
  80. Else
  81.     iArrayIndex = -1
  82.     GetNextItem = ""
  83. End If
  84. End Function
  85.  
  86. Public Sub ClearArray()
  87. Dim i As Integer
  88.  
  89. For i = 0 To 50
  90.     strCommands(i) = ""
  91.     strTemp(i) = ""
  92. Next i
  93.  
  94. iArrayIndex = 0
  95. End Sub
  96.