Avatar of Tom Knowlton
Tom Knowlton
Flag for United States of America asked on

C#, Windows Form - While debugging, what is "owner" in the given context?

System.Windows.Forms.CheckedListBox.ObjectCollection oc = new CheckedListBox.ObjectCollection(checkedListBoxLinesToProcess);


//********************* this line will not compile because "owner" is not known, yet it shows up in the Watch when debugging
int d = ((((System.Windows.Forms.ListBox)(((System.Windows.Forms.CheckedListBox.ObjectCollection)(oc)).owner))).Items).Count;

What is "owner" ?

owner
C#

Avatar of undefined
Last Comment
Tom Knowlton

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
p_davis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tom Knowlton

ASKER
Okay.

But what are they?  What is "owner" "parent" and "child" ?  Are they controls?

Am I doing this correctly?

for (int x = 0; x < checkedListBoxLinesToProcess.Items.Count; x++)
            {
                elb = new EnhancedCheckedListBox();
                elb.message = checkedListBoxLinesToProcess.Items[x].Text;  //what is the correct cast?
                elb.indexValue = checkedListBoxLinesToProcess.Items[x].SelectedIndex; //what is the correct cast?
                elb.mk = MoveKind.None;
                elb.ischecked = checkedListBoxLinesToProcess.GetItemChecked(checkedListBoxLinesToProcess.Items[x].SelectedIndex); //what is the correct cast?
                eclb.Add(elb);
            }

Open in new window

SOLUTION
it_saige

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tom Knowlton

ASKER
I think I figured it out.

It was not a casting problem it was a using the correct methods problem:

for (int x = 0; x < checkedListBoxLinesToProcess.Items.Count; x++)
            {
                elb = new EnhancedCheckedListBox();
                elb.message = checkedListBoxLinesToProcess.Items[x].ToString();
                elb.indexValue = x;
                elb.mk = MoveKind.None;
                elb.ischecked = checkedListBoxLinesToProcess.GetItemChecked(x);
                eclb.Add(elb);
            }

Open in new window

Tom Knowlton

ASKER
Thank you both.
Your help has saved me hundreds of hours of internet surfing.
fblack61