?
Solved

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

Posted on 2016-09-20
5
Medium Priority
?
44 Views
Last Modified: 2016-09-20
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
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 22

Accepted Solution

by:
p_davis earned 1000 total points
ID: 41807353
it seems that someone assumed that the owner property was set for a control. owner parent child are all possible designations.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 41807373
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

0
 
LVL 34

Assisted Solution

by:it_saige
it_saige earned 1000 total points
ID: 41807440
What is it that you are trying to accomplish?  Right now, we do not have enough to go on.  You speak of casting but what is the object you are using to store in the checked listbox objectcollection?  This is what you will need to cast to depending upon how you fill your checked listbox objectcollection.

-saige-
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 41807445
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

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 41807446
Thank you both.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question