checkedlist box problem

Hi all,

I have two problems
1. I have a comma separated string values. I want to load them all into checkedlistbox as items.....HOW?

2. how do I get the itemindex of checkedlistbox, passing the text?

regards and thanks


  • You can't treat a string byref in .NET unfortunately. The only thing you can do is create a class that holds a string and override the ToString() method.

    Here is how you retrieve an item's index.
    var me = new CheckedListBox();
    var s = "This is a string";
    var index = me.Items.Add(s); // you can retrieve when adding
    var altIndex = me.Items.IndexOf(s); // or after the fact.

  • Hi friends,

    it was as simple as it looks!

    arrFieldList = new ArrayList(strAllFields.Split(new char[] { ',' }));

    for (int i = 0; i < arrFieldList.Count; i++)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!