Could you please tell me how to know the status of each
Check Box of the list?
You can check Value property array. Value
property returns and sets the state of the checkbox
displayed in the listbox. The Value property
is an integer array that each element is a list item.
The setting is an integer number specifying the state
of the checkbox. False (default) is unchecked,
True is checked. The syntax is as follows,
Is there a way to turn off the checkmark?
You can set NoCheckmark property to True, and then the
control will not display a checkmark in the front of
Is there a way to make it where you had to
double-click on an item to check the box instead of
a single click?
Yes. You can set ToggleMode
property. There are some choices which let your program
work like other popular software.
Is there a TAG property for each individual
ITEM in the CheckListBox Control, or for only the control
itself? What is the correct syntax?
The Tag property is for only the control itself.
There is an ItemData (Long type) property array
which can be used for each individual item in the CheckListBox
control. ItemData is an array of long integer.
For example, you can use it to store the index of another
string array as followings,
0 ) = 2
CheckListBox1.ItemData( 1 ) = 3
MsgBox arrString(CheckListBox1.ItemData _ (CheckListBox1.ListIndex))
Where arrString is a string array.
I want to use your control in a web page, but it can't
work in a client machine without using the installating
program from you?
CheckListBox is a licensed control. To use licensed
controls in an HTML page on a non-licensed computer,
you must generate a license package file (LPK). The
LPK file contains the run-time licenses for licensed
controls in the HTML page. Lpk_tool.exe, which originally
comes with the Internet Client SDK, generates this file.
You can download the Internet Client SDK from the following
Microsoft Web site:
CheckListBox control on an HTML page, follow these steps:
1) Run Lpk_tool.exe
on a computer that is licensed to use the control.
CheckListBox ActiveX control(in some machines, it may
be shown as "Chklist control"), and then click
Save & Exit, and then type a name for the LPK file.
4) In the
HTML page, insert an <OBJECT> tag for the License
Manager object before any other <OBJECT> tags.
The License Manager is an ActiveX control that is installed
with Internet Explorer.
is for the License Manager and not for CheckListBox
ActiveX controls. You must use the same CLASSID every
time you refer to the LPK file. In addition, you should
keep the Name property of the <PARAM> tag as "LPKPath",
and set the Value property for the <PARAM> tag
of the License Manager object to the LPK file name and
path. This path may be a relative path but must not
refer to a UNC share or a URL on another domain.
you can only have one LPK file for each HTML page, make
sure that you include all of the licensed ActiveX Controls
for the page when you generate your LPK file. For example:
CLASSID = "clsid:5220cb21-c88d-11cf-b347-00aa00a28331"
NAME="LPKPath" VALUE="relative URL to
the <OBJECT> tag for your licensed control afterward.
For example, an HTML page that displays the CheckListBox
ActiveX control looks like this:
to MS knowledge base article "HOWTO:
Use Licensed ActiveX Controls in Internet Explorer [Q159923]."
I was wondering if there is a way to get a horizontal
scroll bar on the CheckListBox?
In Version 2.5 Build 7 and above, this feature is added
to the control. Add following code to add a horizontal
scroll bar to CheckListBox control.
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long,
ByVal wMsg As Long, ByVal wParam As Long,
lParam As Any) As Long
Private Const LB_SETHORIZONTALEXTENT = &H194
Private Sub Form_Load()
ChkList1.AddItem "Line 1"
ChkList1.AddItem "a big Line 2 some
text some text"
ChkList1.AddItem "Line 3"
addHorScrlBarListBox(ByVal refControlListBox As Object)
Dim nRet As Long
Dim nNewWidth As Integer
nNewWidth = 400 '
new width in pixels
nRet = SendMessage(refControlListBox.hwnd,
I want to be able to add a right click on each item
and have a popup menu. One thing that I am having problems
with is that if the item is not selected and you right
click then the popup menu appears but since it is not
selected I do not know which item the popup menu is
for, I get the last item normally selected but not the
one that I right clicked on. Is there a way with the
x and y that I could know where the right click was
done? Is there a way that when the right click is performed
that the item would become selected?
A right click can't select some items automatically.
But you can sends the LB_ITEMFROMPOINT message to retrieve
the zero-based index of the item nearest the specified
point in a list box.
is an example:
LB_ITEMFROMPOINT = &H1A9
SendMessage Lib "user32" Alias "SendMessageA"
hWnd As Long, _
wMsg As Long, _
wParam As Long, _
As Any) As Long
As Long, lYPos As Long
' Convert the cursor position into pixels , because
that is what is needed
CLng(x / Screen.TwipsPerPixelX)
CLng(y / Screen.TwipsPerPixelY)
If the right mouse button is clicked...
= 2 Then
Get the listitem closest to the cursor
NOTE: Since the X and Y values have to be in the form
of high and low
order words, send the values as ((lYPos * 65536) +
SendMessage(ChkFileList.hWnd, LB_ITEMFROMPOINT, 0,
* 65536) + lXPos))
If the returned value is a valid index, then set that
item as the selected
< ChkFileList.ListCount Then
now Popup the menu over the selected item with Selection
' Highlighting it
If not possible to highlight the item then beep