Page 1 of 2 12 LastLast
Results 1 to 40 of 50

Thread: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboBox)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    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
    Attached Images Attached Images     
    Attached Files Attached Files
    Last edited by PGBSoft; Nov 23rd, 2019 at 11:28 PM. Reason: Version changed

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Thank you for the nice comment.

  4. #4
    gibra
    Guest

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    I found a bug.

    If I select the Select all items checkbox, will select all same item. Example:

    SelectedText return:
    Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka

    Select Count return: 20

    Select ItemData return :
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

    Selected Item Indexes/numbers return:
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by gibra View Post
    I found a bug.

    If I select the Select all items checkbox, will select all same item. Example:

    SelectedText return:
    Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka,Sri Lanka

    Select Count return: 20

    Select ItemData return :
    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

    Selected Item Indexes/numbers return:
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    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.

    Name:  ui-test.png
Views: 1984
Size:  25.4 KB

  6. #6
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    578

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    I too have the same bug as Gibra Win 10 1803 17134.137. Just clicked on 'Select All Items' in the IDE with the following result!
    Attached Images Attached Images  

  7. #7
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    578

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    OK....It works ok as an exe. However you need to have it work during testing/design!!!

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Steve,

    I tried to reproduce the issue in VB IDE (SP6) on Win 10 Pro 64-bit, but no issue found. Anyway, I will further check and re-upload the stuff.

    Thanks.
    Last edited by PGBSoft; Jun 30th, 2018 at 09:21 PM.

  9. #9
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by PGBSoft View Post
    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.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by Elroy View Post
    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.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Steve,

    I have made some fixes, can you check it now...
    Thanks

  12. #12
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    578

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Just tested in IDE - All ok now thanks.

  13. #13
    gibra
    Guest

    Re: CheckBoxCombo 1.1 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by Steve Grant View Post
    Just tested in IDE - All ok now thanks.
    I confirm, too.

    Good work PGBSoft!!!
    This is a very usefull control.
    A control that was missing, and now there is!

  14. #14
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    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.
    Attached Images Attached Images  
    Last edited by Jonney; Jul 1st, 2018 at 09:46 PM.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    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.

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Thumbs up Re: CheckBoxCombo 1.2 (A professional, effective and ready-to-use Multi-select ComboB

    CheckBoxCombo 1.2 Released (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

    Note: A must to have stable update.
    Last edited by PGBSoft; Jul 15th, 2018 at 01:29 PM.

  17. #17
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    578

    Re: CheckBoxCombo 1.2 (A professional, effective and ready-to-use Multi-select ComboB

    After quick testing, the control now appears to be stable and a little faster. Well done, a really nice control.

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Thumbs up 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.

  19. #19
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    fast scrolling still got “guo guo” sound.

  20. #20

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Thumbs up Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Revision update 1.3.2 Released (18-07-2018)

    • Made internal improvements in hooking mechanism
    • Bugfixes in ActiveX

  21. #21
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by PGBSoft View Post
    Revision update 1.3.2 Released (18-07-2018)

    • Made internal improvements in hooking mechanism
    • Bugfixes in ActiveX
    More stable now. Thanks.

  22. #22
    gibra
    Guest

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by PGBSoft View Post
    Revision update 1.3.2 Released (18-07-2018)

    • Made internal improvements in hooking mechanism
    • Bugfixes in ActiveX
    Great job.

  23. #23
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    740

    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).

    https://prnt.sc/k9bn3q
    https://prnt.sc/k9bn8s
    Malware analyst, VirusNet developer, HiJackThis+ author || my CodeBank works

  24. #24
    gibra
    Guest

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by Dragokas View Post
    I found the bug (both IDE/compiled, win7):
    No problem for me (tested EXE, IDE on Windows 10 - 1803)
    No problem for me (tested EXE on Windows 7 SP1)

    On Windows 7 SP1 IDE, the translucent rectangle appears for a moment, but then disappears when the list is displayed.


    Last edited by gibra; Jul 22nd, 2018 at 04:13 AM.

  25. #25

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Thumbs up 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)

  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by Dragokas View Post
    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).

    https://prnt.sc/k9bn3q
    https://prnt.sc/k9bn8s
    Quote Originally Posted by gibra View Post
    On Windows 7 SP1 IDE, the translucent rectangle appears for a moment, but then disappears when the list is displayed.
    Thanks to Dragokas and gibra, this issue has been fixed now with the latest Revision update 1.3.3 (23-07-2018).

  27. #27
    Member Dragokas's Avatar
    Join Date
    Aug 2015
    Location
    Ukraine
    Posts
    740

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    PGBSoft, confirmed. Good work.
    Malware analyst, VirusNet developer, HiJackThis+ author || my CodeBank works

  28. #28
    gibra
    Guest

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by Dragokas View Post
    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.
    Last edited by gibra; Jul 25th, 2018 at 04:17 AM.

  29. #29

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.3 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by gibra View Post
    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.

    I will surely address them in the next update.

    Thank you.

    _____________________
    PGBSoft

  30. #30
    gibra
    Guest

    Lightbulb A bug

    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
    Last edited by gibra; Jul 25th, 2018 at 08:12 AM.

  31. #31

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: A bug

    Quote Originally Posted by gibra View Post
    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.

  32. #32
    gibra
    Guest

    Re: A bug

    Quote Originally Posted by PGBSoft View Post
    As a workaround for SQL issue, Try to use

    Code:
    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
    Last edited by gibra; Jul 25th, 2018 at 09:22 AM.

  33. #33

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: A bug

    Sorry for the misleading stuff...

    Quote Originally Posted by gibra View Post
    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.

    Quote Originally Posted by gibra View Post
    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.

  34. #34
    New Member
    Join Date
    Aug 2018
    Posts
    6

    Question 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.

  35. #35

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Thumbs up 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
    • Altered <FillList> method as <FillListByArray>
    • Fixed several minor bugs
    • Updated User Documentation
    • Released database demonstration application

    Note: A must to have minor update. (more stable and flexible)

    Click here to download


    >>Interfaces of database demo application:>>
    Attached Images Attached Images     
    Last edited by PGBSoft; Nov 23rd, 2019 at 11:25 PM.

  36. #36
    gibra
    Guest

    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.

  37. #37

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB

    Quote Originally Posted by gibra View Post
    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.

  38. #38
    gibra
    Guest

    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.

    P.S.
    When you reply, pay attention to do not overquoting, please, it's useless and annoying.
    Overquoting: https://en.wikipedia.org/wiki/Wikipedia:Overquoting

  39. #39

    Thread Starter
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB

    Thank you for the feedback.

    Quote Originally Posted by gibra View Post
    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.

  40. #40
    New Member
    Join Date
    Aug 2018
    Posts
    6

    Re: CheckBoxCombo 1.4 (A professional, effective and ready-to-use Multi-select ComboB

    Version 1.4 - there was a problem.
    Registration is done by the administrator.
    Name:  2018-08-10_212838.jpg
Views: 1594
Size:  153.0 KB

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width