Solved

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

Posted on 2016-09-20
5
40 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
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: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 33

Assisted Solution

by:it_saige
it_saige earned 250 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: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:knowlton
ID: 41807446
Thank you both.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

773 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