Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Class: HistoryList in Category General VBA/VB6 : Abstract Data Types from Total Visual SourceBook

Class that implements a history list in VBA and VB6.

If you have ever used a web browser, you are already familiar with the concept of a History List. When you press your browser's Back button, you return the previous page you viewed. Similarly, when you press the Next button, you move to the page after the one you are currently on. This class implements the History List mechanism as a set of two stacks: a forward stack and a backward stack. The forward stack contains items that have been popped off the history list, whereas the backward stack contains items that have been pushed onto the history list. By maintaining these two stacks, the class keeps a history list that allows you to move back and forth through a history of items.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CHistoryList class
BackEnabled Property Determine whether Back should be enabled.
CurrentItem Property Get the current item from the history list.
ForwardEnabled Property Determine whether Forward should be enabled.
MaxItems Property Get the maximum number of items that can be added to the history list.
Class_Initialize Initialize Set initial values to defaults which may be overridden with property settings.
Add Method Add an item to the history list.
Back Method Move back in the history list.
EnumerateBack Method Enumerate the items available with the back method.
EnumerateForward Method Enumerate the items available with the forward method.
Forward Method Move forward in the history list.
GetItem Private Get an item in the history list.

Example Code for Using Class: HistoryList

' Example of CHistoryList
'
' To try this example, do the following:
' 1. Create a new form
' 2. Add a command button named 'cmdTest'
' 3. Paste all the code from this example to the new form's module
' 4. Run the form

Private HistoryList As CHistoryList

Private Sub cmdTest_Click()
  Dim varItem As Variant
  Dim varItems() As Variant

  ' Instantiate the History List variable
  Set HistoryList = New CHistoryList

  ' Override the standard MaxItems property to allow 10 items on the list
  HistoryList.MaxItems = 10

  HistoryList.Add "A"
  HistoryList.Add "B"
  HistoryList.Add "C"
  HistoryList.Add "D"
  HistoryList.Add "E"
  HistoryList.Add "F"

  HistoryList.Back
  HistoryList.Back
  HistoryList.Back

  Debug.Print HistoryList.CurrentItem

  HistoryList.Forward
  Debug.Print HistoryList.CurrentItem

  Debug.Print "Back Items: "
  HistoryList.EnumerateBack varItems
  For Each varItem In varItems
    Debug.Print varItem
  Next varItem

  Debug.Print "Forward Items: "
  HistoryList.EnumerateForward varItems
  For Each varItem In varItems
    Debug.Print varItem
  Next varItem

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources