Add variable to checkedlistbox

Posted by lefty1984 on 15-Jul-2014 03:39

I am new to so i've got a question to u guys. How can I add a variable to a checkedlistbox? I thought like this? But I get an error. arrayvar0[1] = "Add-MailboxPermission " + STRING(THIS-OBJECT:IDENTITY:TEXT) + " -User user -AccessRights FullAccess -InheritanceType all". Can anyone help me? greetz Rick

All Replies

Posted by Rob Debbage on 16-Jul-2014 02:14


I'm assuming that when you say "add a variable", you meant that you want to add an item to the CheckedListBox. If so, you should be able to use the Add() method on the CheckedListBox's Item collection to do this. For example,


"test1" will appear in the CheckedListBox.



Posted by lefty1984 on 16-Jul-2014 02:55


Thanks for your reply, but I want to know if it is possible to use something like this? i've got something like 20 items in my checkedlistbox. If im using ADD I have to fill it after my fillinboxes.

arrayvar0[1] = "Add-MailboxPermission " + STRING(THIS-OBJECT:IDENTITY:TEXT) + " -User user -AccessRights FullAccess -InheritanceType all".

Posted by Rob Debbage on 16-Jul-2014 03:27


There are probably many ways to do this. Here are a couple of suggestions.

Option#1 - use the AddRange method on the Items collection to add a pre-filled array:

   DEFINE VARIABLE arrayvar0 AS System.Object EXTENT 5 NO-UNDO.


       arrayvar0[1] = "test1"

       arrayvar0[2] = "test2"

       arrayvar0[3] = "test3"

       arrayvar0[4] = "test4"

       arrayvar0[5] = "test5"



Option #2 - populate checkedListBox via a method called in the constructor after other controls are initialized.

Create a new method that populates the checkedListBox using the Add() method.

Call this method in your form's Constructor after InitializeComponent() is called, e.g.







This thread is closed