Solved

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

Posted on 2016-09-20
5
32 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:knowlton
  • 3
5 Comments
 
LVL 22

Accepted Solution

by:
p_davis earned 250 total points
Comment Utility
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:knowlton
Comment Utility
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 32

Assisted Solution

by:it_saige
it_saige earned 250 total points
Comment Utility
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:knowlton
Comment Utility
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:knowlton
Comment Utility
Thank you both.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now