Add variable to checkedlistbox

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

I am new to progress.net 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

Hi,

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,

checkedListBox1:Items:Add("test1").

"test1" will appear in the CheckedListBox.

HTH,

Rob

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

Hi,

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

Hello,

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.

       ASSIGN

       arrayvar0[1] = "test1"

       arrayvar0[2] = "test2"

       arrayvar0[3] = "test3"

       arrayvar0[4] = "test4"

       arrayvar0[5] = "test5"

       .

       checkedListBox1:Items:AddRange(arrayvar0).

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.

CONSTRUCTOR PUBLIC ChecklistBox (  ):

       SUPER().

       InitializeComponent().

       THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).

       populateCheckedListBox().

       ...

This thread is closed