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: ConCat in Category General VBA/VB6 : String Handling from Total Visual SourceBook

High performance concatenation of large strings in VBA and VB6.

When concatenating large strings on the order of 50kb or larger (for example, building an RTF string), the length of time to complete becomes exponentially longer. This is because Visual Basic re-allocates the string each time it is concatenated. This class implements an alternative to normal concatenation that does not re-allocate the string each time it is concatenated.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CConCat class
Text Property Get the current text string. The Get method of this property trims off any text leftover in the pre-allocated internal string. This prevents up to 50k of spaces from being returned on the end of the string.
Class_Initialize Initialize Set initial values to defaults which may be overridden with property settings
Append Method Appends a string to the end of the internal string. This function uses the trick of pre-allocating the internal string that is being appended to. This is what gives the performance benefits of this class.

Example Code for Using Class: ConCat

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

Private Sub cmdTest_Click()
  Dim ConCat As CConCat
  Dim lngCounter As Long

  Set ConCat = New CConCat

  ' set the initial string
  ConCat.Text = "Append This Text"

  ' Concatenate the string the specified number of times
  For lngCounter = 1 To 100
    ConCat.Append "Append This Text"
  Next lngCounter

  ' Display the result of the concatenation
  Debug.Print ConCat.Text

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