CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboBox)
What is CheckBoxCombo?
CheckBoxCombo is a general-purpose Multi-select ComboBox User Control designed for Visual Basic. It differs from the conventional ComboBox behavior by allowing user to select one or more items from its drop-down list. CheckBoxCombo greately integrates the existing power of standard VB controls (ComboBox and ListBox) to provide its powerful features and can be easily integrated into any sort of Windows GUI project in VB. Sure, it's a must to have companion in your standard VB Toolbox.
Why is CheckBoxCombo?
The conventional ComboBox control in VB allows you to select only one item at a time from its drop-down list. It cannot be used in situations where you need to select more than one item at a time. For this particular purpose you should use a multi-choice enabled ListBox, which is all right, if you have enough space on your interface/form. But what if you have a very limited space to place the ListBox with dozens of items; may be closer to the bottom of your interface? CheckBoxCombo is a great replacement in such situations where you need to save the space on your UI (User Interface), with its great dynamic features.
CheckBoxCombo is also elegant in providing multiple inputs to SQL queries in database programming.
Further, CheckBoxCombo allows you to set any of its properties even at run-time, which is not even allowed by the traditional ComboBox control. One such property is [sorted], which you can dynamically set the sorting at run-time. This gives you a great flexibility in using the user control simply by overriding the design-time settings as you wish. CheckBoxCombo also exposes some methods to support less coding when working with it.
Its [OnListSearch] property helps user to search and select any item in the list easily.
The user control greatly supports for modern visual styles since it integrates the existing VB controls which support visual styles.
The ActiveX version of CheckBoxCombo is fully compatible even with VBA, if you need to use CheckBoxCombo with Microsoft Office (32-bit) as well.
With CheckBoxCombo's professional features and familiarity in use due to nearly familiar syntax it provides, you will more feel it like a must to have control in your standard VB Toolbox.
Outstanding features of CheckBoxCombo:
Professional, effective and ready-to-use design for any sort of Windows GUI project in VB
No dependent modules, extremely easy to integrate as a single module
Extremely easy to use
Ability to setup all supported properties even at run-time
Very smooth and faster operation, even with thousands of items
Dynamic sorting on ascending or descending, supporting thousands of items
Supports for different longest-text-display modes
Search-and-select feature for items
Exposes methods to support less coding
Highly flexible and configurable
Powerful and reliable on all supported operations
User friendly and familiar syntax
Supports for all flavors of Windows from Windows XP with visual styles
Full ActiveX compatibility with VBA (Microsoft Office 32-bit)
And more...
Note: Please go through the User Documentation and study the Demo Applications attached herewith, so that you may get a clear idea about CheckBoxCombo.
Comments, suggestions are greatly welcome...
Version History:
Code:
Revision update 1.4.1 (24-11-2019)
--------------------------------
• Fixed a minor bug in list search.
CheckBoxCombo 1.4 (03-08-2018)
------------------------------
• Newly introduced <FillListByRecordset> method.
Now, CheckBoxCombo can be directly populated from a Database
with multiple options for greater flexibility
• Added missing property, [NewItem]
• Changed <ItemData, SelItem, SelItemData, SelIndex, SelCount>
methods as properties
• Introduced an optional parameter of type Boolean,
{DelimiterConcatIncluded} to be used with the read-only properties of
[SelItem, SelItemData, SelIndex, Text]. Now, the values of them can be
returned excluding the DelimiterConcat character used with the
[DelimiterConcat] property
• Introduced an additional option {None} with the [DelimiterConcat]
property
• Altered <FillList> method as <FillListByArray>
• Fixed several minor bugs
• Updated User Documentation
• Released database demonstration application
Revision update 1.3.3 (23-07-2018)
----------------------------------
• Fixed a minor bug when displaying the drop-down list
(Translucent rectangle appearance issue on the screen
due to some visual-effect settings of the OS)
Revision update 1.3.2 (18-07-2018)
----------------------------------
• Made internal improvements in hooking machanism
• Bugfixes in ActiveX
CheckBoxCombo 1.3 (15-07-2018)
------------------------------
• Made changes to ActiveX version to be fully compatible with VBA.
Now it’s possible to use CheckBoxCombo even in UserForms,
Spreadsheets, Documents, etc. in Microsoft Office 32-bit editions
• Optimized hooking mechanism
• Fixed issues with MDI
• Fixed issues related to Display Monitor
• Fixed issues with mouse-wheel and scrollbars
• Made minor changes to documentation
CheckBoxCombo 1.2 (05-07-2018)
------------------------------
• Included FillList method. Now the list can be filled by
a String/Variant type array
• Fixed the scrollbar issue
• Enhanced the mouse-click support for selecting/unselecting
items in the list. Now mouse-click supports anywhere on the
list item for quick selections
• Fixed several minor bugs and general optimizations were done
• Updated User Documentation
CheckBoxCombo 1.1 (30-06-2018)
------------------------------
• Made syntax changes of AddItem, RemoveItem and FindItem methods
• Introduced DelimiterConact Property
• Introduced CBCUPdate Property
• Introduced CBCUpdateCompleted event
• Revised <Change> event in v1.0 to <ItemCheck>
• Fixed several bugs and some optimizations were done
• Updated User Documentation
CheckBoxCombo 1.0 (26-06-2018)
------------------------------
• The initial version of CheckBoxCombo
Last edited by PGBSoft; Nov 23rd, 2019 at 11:28 PM.
Reason: Version changed
Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB
Very nice implementation.
And welcome to VBForums.
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
gibra,
I tried for this bug on WinXP, Win7 32/64-bit, and Win10 64-bit, but, unfortunately, I couldn't reproduce it. See the attached screenshot on Win10.
Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by PGBSoft
If you are referring to “On Error Resume Next” statements in property settings, yes, most of them should not be. I simply put them at one stage of the development for a particular testing; hence they need to be cleared. Anyway, I will update the code. Thanks for pointing out it, which I had missed.
For your question about Text property setting, the property is not purposely allowed to set, since it is considered to be a read-only property. The reason is simply integrity purpose, because, the user is only allowed to select items from the list, where the selection is updated as the Text. If it is allowed to set this Text externally, it is going to be a problem. Simply, imagine a Dropdown list style of a regular ComboBox; its Text property setting is read-only when the Text to be set is not in the list. However, you can still set the Text here via the DefaultText property, but that is for a different purpose.
Hi PGBSoft,
I thought I'd just jump over here since newbie2 has his thread marked as resolved.
Regarding the "On Error Resume Next", I don't mind them as long as I know what they're for. However, I've also gotten into the habit of "closing" them with "On Error Goto 0" in the same procedure. If you don't do that, you might leave an error number in the Error object. That was illustrated to me by Bonnie West quite some time ago.
Also, I guess I need to do more testing. However, I use a ComboBox as a "Dropdown List" quite often. But, when storing and fetching data from a database, I often use the .Text property to put the last value back into the ComboBox.
In my simpler ComboCheck control, I just do it all in a very similar way. I probably need to "play" more, as I'm sure you have a way to indicate the previously selected value(s) in your control, just not through the .Text property.
Let me outline a bit more of an example. My software is all medical (basically handicapped children). Let's say we're tracking what braces they wear. Some options are AFO, SMO, UCBL, etc. This is one place I use my multi-select combo, in that they may have more than one that they wear for different occasions. This is stored as a semi-colon separated string in the database. When the therapist re-examines the patient's encounter, the list (somehow delimited) should re-appear in the ComboBox.
Take Care,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by Elroy
In my simpler ComboCheck control, I just do it all in a very similar way. I probably need to "play" more, as I'm sure you have a way to indicate the previously selected value(s) in your control, just not through the .Text property.
Let me outline a bit more of an example. My software is all medical (basically handicapped children). Let's say we're tracking what braces they wear. Some options are AFO, SMO, UCBL, etc. This is one place I use my multi-select combo, in that they may have more than one that they wear for different occasions. This is stored as a semi-colon separated string in the database. When the therapist re-examines the patient's encounter, the list (somehow delimited) should re-appear in the ComboBox.
Elroy
Yes, that is pretty easy with CheckBoxCombo. Just get the selected indexes or items with .SelIndex() or .SelItem() methods and save it in the database. When you restore them just call .SelectList(Your saved values in db). Please refer the Documentation. It is always better to save the indexes in the database if you have a fixed list. Please see the below code blocks too.
For getting selected Indexes/Items in the list with CheckBoxCombo
Code:
'Read whatever value you need, Indexes/Items
Dim varIndexes As String: varIndexes = CheckBoxCombo.SelIndex 'get all the selected indexes
Dim varItems as String: varItems = CheckBoxCombo.SelItem 'get all the selected items
'Now store/save whatever value you need, Indexes/Items, may be in your database
For restoring Indexes/Items in the list with CheckBoxCombo
Code:
'Read whatever stored/saved value you need, Indexes/Items, may be from your database
Dim varRestoreIndexes As String: varRestoreIndexes = 'read the previously stored index values
Dim varRestoreItems as String: varRestoreItems = 'read the previously stored items
'Restore whatever value you need, Indexes/Items
CheckBoxCombo.SelectList(varRestoreIndexes) 'restore/select the indexes in the list
CheckBoxCombo.SelectList(varRestoreItems, Item) 'restore/select the items in the list
Hope this is easy as 1 2 3 and saves pretty much of your code, isn't it?
Please read the documentation for more information.
Last edited by PGBSoft; Jul 1st, 2018 at 09:50 PM.
Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB
there's a common issue for such COMBO control is the hook. I think you can fix.
Try to use mouse fast scroll few times then the Listbox can't hide (EXE demo).
On IDE, try to fast scroll by roller, there's a "guo guo" sound" but can hide sometime,sometime can't.
Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB
Jonney,
I suppose the root issue might be related to the input speed in foreground window, which leads hook procedure to time out and hook is silently removed. I will look into this. Thanks.
Last edited by PGBSoft; Jul 2nd, 2018 at 03:34 AM.
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
CheckBoxCombo 1.3 Released (15-07-2018)
Made changes to ActiveX version to be fully compatible with VBA. Now it’s possible to use CheckBoxCombo in UserForms, Spreadsheets, Documents, etc. in Microsoft Office 32-bit editions
Optimized hooking mechanism
Fixed issues with MDI
Fixed issues related to Display Monitor
Fixed issues with mouse-wheel and scrollbars
Made minor changes to documentation
Note:A more stable update.
Last edited by PGBSoft; Jul 15th, 2018 at 01:29 PM.
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Hi, PGBSoft !
Thanks for the control.
I found the bug (both IDE/compiled, win7): when there is no place to drop down the list it drow up, but under the control a translucent rectangle appears (see screenshot #1).
Furthermore, in such case, if you don't close the list, that rectangle left on the form forever (see screenshot #2).
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Revision update 1.3.3 Released (23-07-2018)
Fixed a minor bug when displaying the drop-down list (Translucent rectangle appearance issue on the screen due to some visual-effect settings of the OS)
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by Dragokas
I found the bug (both IDE/compiled, win7): when there is no place to drop down the list it drow up, but under the control a translucent rectangle appears (see screenshot #1).
Furthermore, in such case, if you don't close the list, that rectangle left on the form forever (see screenshot #2).
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by Dragokas
PGBSoft, confirmed. Good work.
I agree 100%, for version 1.3.3 too.
However, seem that ItemData property can't be set by code. Example:
Code:
With cboUser
.Clear
.AddItem "MyItem"
.ItemData(.NewIndex) = rs!IDUser
End With
Why?
ItemData seem to be a Method read-only, instead of Property as with standard VB.ComboBox and also third-party comboboxes.
This creates a problem when we use your CheckBoxCombo control with pre-existing routines that populate the comboboxes.
Compatibility is completely lost.
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by gibra
However, seem that ItemData property can't be set by code. Example:
Code:
With cboUser
.Clear
.AddItem "MyItem"
.ItemData(.NewIndex) = rs!IDUser
End With
Why?
ItemData seem to be a Method read-only, instead of Property as with standard VB.ComboBox and also third-party comboboxes.
This creates a problem when we use your CheckBoxCombo control with pre-existing routines that populate the comboboxes.
Compatibility is completely lost.
Hi gibra,
Actually, the method, ItemData can be used for both Read/Write to ItemData, but its implementation is slightly different from a typical ComboBox.
Code:
Dim var As Long: var = CheckBoxCombo.ItemData(1) 'gets the ItemData value at Index 1
CheckBoxCombo.ItemData 5, 6 'sets the ItemData value as 6 at the index 5
Unfortunately the NewIndex property is currently missing.
The SelItemData and SelText properties contains strange ASCII control character (28, FileSeparator)
(see https://theasciicode.com.ar/ table)
To reproduce issue in the original project add this code to form:
After run the project add in combo countries:
Sri Lanka,Zambia,Jamaica
Code:
Private Sub txtSelectedItemData_Click()
Dim i As Long
Dim SelItems As String
SelItems = CheckBoxCombo1.SelItemData
For i = 1 To Len(SelItems)
Debug.Print i, Chr$(Asc(Mid$(SelItems, i, 1))), Asc(Mid$(SelItems, i, 1))
Next i
End Sub
Click on txtSelectedItemData and in Immediate windows you see:
Code:
1 1 49
2 , 44
3 28
4 4 52
5 , 44
6 28
7 6 54
Code:
Private Sub txtSelectedText_Click()
Dim i As Long
Dim SelText As String
SelText = CheckBoxCombo1.SelItem
For i = 1 To Len(SelText)
Debug.Print i, Chr$(Asc(Mid$(SelText, i, 1))), Asc(Mid$(SelText, i, 1))
Next i
End Sub
Click on txtSelectedText and in Immediate windows you see:
Code:
1 S 83
2 r 114
3 i 105
4 32
5 L 76
6 a 97
7 n 110
8 k 107
9 a 97
10 , 44
11 28
12 Z 90
13 a 97
14 m 109
15 b 98
16 i 105
17 a 97
18 , 44
19 28
20 J 74
21 a 97
22 m 109
23 a 97
24 i 105
25 c 99
26 a 97
So, if we try to use the SelItemData value with IN operator in a query, i.e. :
Code:
SELECT * FROM MyTable WHERE ID IN (" & CheckBoxCombo1 & ")"
We get a sintax error.
EDIT: seem the same problem for txtSelectedIndexes...
EDIT2: to solve this issue we have to re-elaborate the property. Example:
Code:
Dim SelItems As String
Dim newSelItmes As String
SelItems = cbo.SelItemData
newSelItems = vbNullString
If SelItems > vbNullString Then
For i = 1 To Len(SelItems)
If Mid$(SelItems, i, 1) <> vbNullString Then
If Asc(Mid$(SelItems, i, 1)) <> 28 Then
'Debug.Print i, Chr$(Asc(Mid$(SelItems, i, 1))), Asc(Mid$(SelItems, i, 1))
newSelItems = newSelItems & Chr$(Asc(Mid$(SelItems, i, 1)))
End If
End If
Next i
Debug.Print newSelItems
End If
The SelItemData and SelText properties contains strange ASCII control character (28, FileSeparator)
(see https://theasciicode.com.ar/ table)
To reproduce issue in the original project add this code to form:
After run the project add in combo countries:
Sri Lanka,Zambia,Jamaica
Code:
Private Sub txtSelectedItemData_Click()
Dim i As Long
Dim SelItems As String
SelItems = CheckBoxCombo1.SelItemData
For i = 1 To Len(SelItems)
Debug.Print i, Chr$(Asc(Mid$(SelItems, i, 1))), Asc(Mid$(SelItems, i, 1))
Next i
End Sub
Click on txtSelectedItemData and in Immediate windows you see:
Code:
1 1 49
2 , 44
3 28
4 4 52
5 , 44
6 28
7 6 54
Code:
Private Sub txtSelectedText_Click()
Dim i As Long
Dim SelText As String
SelText = CheckBoxCombo1.SelItem
For i = 1 To Len(SelText)
Debug.Print i, Chr$(Asc(Mid$(SelText, i, 1))), Asc(Mid$(SelText, i, 1))
Next i
End Sub
Click on txtSelectedText and in Immediate windows you see:
Code:
1 S 83
2 r 114
3 i 105
4 32
5 L 76
6 a 97
7 n 110
8 k 107
9 a 97
10 , 44
11 28
12 Z 90
13 a 97
14 m 109
15 b 98
16 i 105
17 a 97
18 , 44
19 28
20 J 74
21 a 97
22 m 109
23 a 97
24 i 105
25 c 99
26 a 97
So, if we try to use the SelItemData value with IN operator in a query, i.e. :
Code:
SELECT * FROM MyTable WHERE ID IN (" & CheckBoxCombo1 & ")"
We get a sintax error.
EDIT: seem the same problem for txtSelectedIndexes...
Hi gibra,
Actually this behavior is by design with the introduction of DelimiterConcat property based on non-printing ASCII Characters. (Please See the documentation.). However, I will try to change its default to none.
As a workaround for SQL issue, Try to use
Code:
SELECT * FROM MyTable WHERE ID IN (" & Replace(CheckBoxCombo1.SelItem, CheckBoxCombo1.Delimiter, ",") & ")"
Last edited by PGBSoft; Jul 25th, 2018 at 08:32 AM.
SELECT * FROM MyTable WHERE ID IN (" & Replace(CheckBoxCombo1.SelItem, CheckBoxCombo1.Delimiter, ",") & ")"
Thank. I will try.
However, the documentation about Delimiter says:
The Delimiter is a Get/Set property basically used as a seperator for the selected items in the drop-down list. You can set any character or combination, which is easy to read (Eg: |;~) without worrying about delimiter collision. The default is "," (Comma).
Note:If you wish, you may keep the Delimiter blank, which is still handled by the DelimiterConcat, but never recommended.
While about DelimiterConcat says:
The DelimiterConcat is a newly introduced property to avoid delimiter collision. Now the delimiter you set, is internally concatenated with a non-printing ASCII character used as an Information Seperator, based on four options, [Chr(28) - File separator, Chr(29) - Group separator, Chr(30) - Record separator, Chr(31) - Unit separator]. The property is a Get/Set property with the default of "Chr(28) - File separator".
So if is internally concatenated I'm inclined to think that I do not have to worry about which internal delimiter is used, but only that the Delimiter is the default one, that is the comma.
Perhaps (i think) it would be useful if there were also other properties that simply return the values delimited by the Delimiter, which do not contain the DelimiterConcat character.
As seen in textboxes, where it is impossible to understand that there is a second delimiter. In fact this had misled me
So if is internally concatenated I'm inclined to think that I do not have to worry about which internal delimiter is used, but only that the Delimiter is the default one, that is the comma.
However, when working with the code, you can simply get the delimiter by CheckBoxCombo.Delimiter property (which is actually concatenated with the DelimiterConcat character), which can be simply used for the operations of splitting, replacing, ect. on SelItem, SelItemData and SelIndex values. This is actually done for the prevention of delimiter collision.
Originally Posted by gibra
Perhaps (i think) it would be useful if there were also other properties that simply return the values delimited by the Delimiter, which do not contain the DelimiterConcat character.
Good Idea!, I will introduce an optional parameter to be used with SelItem, SelItemData and SelIndex properties, and an additional option, [None] to the DelimiterConcat property setting for more flexibility.
Last edited by PGBSoft; Jul 25th, 2018 at 11:56 PM.
Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB
Problem using - arr = Split (CheckBoxCombo.SelItem, ",")
I fill the array with the selected items in the list. After, I use an array to insert the data in the query string to the database. The query consistently returned an incomplete set of data, and I did not understand why.
But one day, by copying a query string into a text editor, I found the hidden characters in the string. These hidden symbols were the symbols DelimiterConcat
Here is part of the query string ... 3-1, 3-3, 3-4 are data from the array (arr)
"(SRSKV.SKV)='3-1' OR (SRSKV.SKV)='FS3-3' OR (SRSKV.SKV)='FS3-4'" ...... FS - hidden symbols.
How can I get rid of these hidden symbols?
p.s Sorry did not notice Replace(CheckBoxCombo1.SelItem, CheckBoxCombo1.Delimiter, ",").... It works
Last edited by bormman; Aug 1st, 2018 at 12:53 PM.
Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB
CheckBoxCombo 1.4 Released (03-08-2018)
Newly introduced <FillListByRecordset> method. Now, CheckBoxCombo can be directly populated from a Database with multiple options for greater flexibility
Added missing property, [NewItem]
Changed <ItemData, SelItem, SelItemData, SelIndex, SelCount> methods as properties
Introduced an optional parameter of type Boolean, {DelimiterConcatIncluded} to be used with the read-only properties of [SelItem, SelItemData, SelIndex, Text]. Now, the values of them can be returned excluding the DelimiterConcat character used with the [DelimiterConcat] property
Introduced an additional option {None} with the [DelimiterConcat] property
Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB
The Recordset sample doesn't work as expected when language isn't english.
This becuase the Selected property return a boolean value translated on current language.
Example, in Italian, Falso or Vero are returned by propperty, instead of False or True.
Because of this the query value in Private Sub CheckBoxCombo1_ItemCheck(Item As Integer) become:
Code:
UPDATE CountryList SET CheckedState = Vero WHERE ID = 1
or
Code:
UPDATE CountryList SET CheckedState = Falso WHERE ID = 1
Therefore nothing will updated on table CountryList on my system (italian).
But the use of this values maybe good when you work with Access databases only, that recognize False and True as boolean values, but only is they are on english language.
Also, in SQL Server the related data type of Boolean is Bit (0/1) so should be good if the Selected return 0 or 1, instead of False or True.
Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB
Originally Posted by gibra
The Recordset sample doesn't work as expected when language isn't english.
This becuase the Selected property return a boolean value translated on current language.
Example, in Italian, Falso or Vero are returned by propperty, instead of False or True.
Because of this the query value in Private Sub CheckBoxCombo1_ItemCheck(Item As Integer) become:
Code:
UPDATE CountryList SET CheckedState = Vero WHERE ID = 1
or
Code:
UPDATE CountryList SET CheckedState = Falso WHERE ID = 1
Therefore nothing will updated on table CountryList on my system (italian).
But the use of this values maybe good when you work with Access databases only, that recognize False and True as boolean values, but only is they are on english language.
Also, in SQL Server the related data type of Boolean is Bit (0/1) so should be good if the Selected return 0 or 1, instead of False or True.
Hi gibra,
The database demo was simply designed to show typical examples with some of CheckBoxCombo's possibilities, where you can do your own-customization as you wish.
The [CheckedState] field in CountryList table does not necessary to be a Boolean type; it may be a Type of Number, int, Text, varchar, ect. with an appropriate value of [1 or 0] OR ["1" or "0"] OR ["True" or "False"] OR ["Vero" or "Falso" - (if your language is Italian OR such with other language)] representing the checked state of items. What is needed to be done is to implement the appropriate changes in the query.
So for your language issue, try to use something like as follows in CheckBoxCombo1_ItemCheck.
Code:
query = "UPDATE CountryList SET CheckedState = " & IIf(CheckBoxCombo1.Selected(Item) = Vero, True, False) & " WHERE ID = " & CheckBoxCombo1.ItemData(Item)
OR
Code:
query = "UPDATE CountryList SET CheckedState = " & IIf(CheckBoxCombo1.Selected(Item) = Vero, 1, 0) & " WHERE ID = " & CheckBoxCombo1.ItemData(Item)
Further, FillListByRecordset method of CheckBoxCombo is flexible enough to use with its different options as per your requirement. (In order to use FillListByRecordset method, the minimum requirement is, you should have only one field in a table representing its DisplayMember parameter, which is for populating items in CheckBoxCombo.)
Thank you.
______________
PGBSoft
Last edited by PGBSoft; Aug 5th, 2018 at 12:37 AM.
Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB
Everything you've explained is now known for decades. Thanks.
I see instead that you did not understand my observation.
The problem is neither the database, nor the table, nor the type of field.
The problem is that the Selected property returns a value translated into the current language, this does not have to happen.
Moreover, False and True are not valid values for any database.
To be truly usable by everyone, in any language, it should return a standard value, such as 0/1 or 0/-1 or False/True.
Anyway, it does not matter, I will go to modify the source code of your user control.
Thanks anyway for the excellent work.
Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB
Thank you for the feedback.
Originally Posted by gibra
The problem is neither the database, nor the table, nor the type of field.
The problem is that the Selected property returns a value translated into the current language, this does not have to happen.
Moreover, False and True are not valid values for any database.
To be truly usable by everyone, in any language, it should return a standard value, such as 0/1 or 0/-1 or False/True.
Well, but I don't think this behavior is needed for most of the cases. As far as I know, the return type of the Selected property of a standard control such as ListBox is Boolean by design leading the control to be used easily with less compatibility issues. Since there are many workarounds to solve the type of issues addressed, I don't think changing the standard behavior of a property is much needed.
Eg:
Code:
query = "UPDATE CountryList SET CheckedState = " & CInt(CheckBoxCombo1.Selected(Item)) & " WHERE ID = " & CheckBoxCombo1.ItemData(Item)
Last edited by PGBSoft; Aug 6th, 2018 at 10:13 PM.