[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2016-09-20
5
Medium Priority
?
51 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
  • 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 35

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 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