Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

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

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available 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

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: Microsoft Visual Basic 6 : Controls
Description: Code for working with VB6 controls

Module: modListBox

Routines to extend the functionality of the standard VB ListBox control.

Some of these procedures expose features which are inherent in the Windows control, but are not exposed by VB (such as the ability to set add scrollbars or to set the height of items in the list.) Other procedures add entirely new functionality such as loading a DAO recordset into an unbound list box.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modListBox module
AddItemDataListBox Procedure Adds an item to a list box, and the itemdata value associated with that item, in a single function call
AddListBoxHSB Procedure Adds a horizontal scrollbar to a list box. VB does not allow you to specify that a horizontal scrollbar should appear for a list box. When items are too long to fit they are simply chopped off. By using a Windows API call you can specify that the logical width of the list box is different from the actual width. When the logical width is greater than the actual width, Windows automatically adds a horizontal scrollbar.
ADORecordSetToListBox Procedure Displays the contents of an ADO recordset in a standard unbound list box. You are responsible for creating a recordset object in your code and passing it to this subroutine. You can create a recordset based on an entire table, or you can limit the values by using a query or a SQL statement. You may designate one field in the recordset to display in the list box, and another field to store in the ItemData property. Note that if you use a query to populate the list box the display "field" can consist of a calculated expression, such as: SELECT LastName & ", " & FirstName AS FullName, CustID From Customers You could choose "FullName" as the display field and "CustID" as the key field to store in the ItemData property. Note that the value for the ItemData must be a storable in a Long Integer, so textual keys will not work. Note: use of the procedure requires you to have a reference to Microsoft ADO in your project
BinarySearchListbox Procedure Use a binary search to find a value in a list box. A binary search works by dividing the values to be searched in half. If the search value is less than the value at the halfway point, then the top half is searched. If the value is greater than the value at the halfway point, then the bottom half is searched. This process is repeated until the value is either found, or no more values remain to be searched. This technique requires that the listbox be sorted.
ClearSelectionsListBox Procedure Clears the selections for a multi-select list box. This function allows you to clear the selection from a multi-select list box with a single function instead of having to loop through each item separately.
CopyListBoxItemsToCB Procedure Copies selected items in a listbox to the clipboard
FillDrivesListBox Procedure Fills a list box with a list of the local and mapped disk drives on the system
FillFilesListBox Procedure Fills a list box with a list of the files in a specified location
FillFoldersListBox Procedure Fills a list box with a list of the folders in a specified location
FindStringListBox Procedure Finds the line on a list box containing the search string. This function uses the Windows API SendMessage command to quickly find a string in a standard list box control. You may search either for exact matches, or partial matches on the beginning of the list box item. Note that case is not considered in doing the search, even if the fExact argument is true.
RecordSetToListBox Procedure Displays the contents of a recordset in a standard unbound list box. You are responsible for creating a recordset object in your code and passing it to this subroutine. You can create a recordset based on an entire table, or you can limit the values by using a query or a SQL statement. You may designate one field in the recordset to display in the list box, and another field to store in the ItemData property. Note that if you use a query to populate the list box the display "field" can consist of a calculated expression, such as: SELECT LastName & ", " & FirstName AS FullName, CustID From Customers You could choose "FullName" as the display field and "CustID" as the key field to store in the ItemData property. Note that the value for the ItemData must be a storable in a Long Integer, so textual keys will not work. Note: use of the procedure requires you to have a reference to Microsoft DAO in your project
SetListBoxItemHeight Procedure Set the height of items in a list box. VB normally uses the standard height for items in a listbox based on the type and size of the font in the list box. Using Windows API calls you can specify a different height.
SetListBoxTabStops Procedure Set tab stops for a list box. The standard VB list box uses the default tab stop positions. Using this procedure, you can create an array of tab stop positions to control the tab stops in a list box.

Overview 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

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence