Inconsistent accessibility: field type 'myListView' is less accessible than field 'mainForm.myListView2'

I have a main form where I have built a listview (public) using the VS IDE (MS VS C# Express 2008).  I have a class that is trying to reference that listview, but I'm gettting the above error.

What exactly does this mean, and how do I fix it?
rmmarshAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ssflynnCommented:
This means that one class is declared as "Public" and another class has been declared as "Private" or "Internal"
0
philipjonathanCommented:
Declare myListView as public
0
rmmarshAuthor Commented:
MyListView is public... 
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

rmmarshAuthor Commented:
The listview is in the main form which is also public... I have attached code snippets...
                //  now, present the data...
                mainForm mf = new mainForm(false);  //  don't show the splash screen or do any other initialization
                int i = 0;
                foreach (object obj in alData)
                {
                    ListViewItem lvi = new ListViewItem(alData[i].ASIN);
                        lvi.SubItems.Add(alData[i].Title);
                    lvi.SubItems.Add(alData[i].Author);
                    lvi.SubItems.Add(alData[i].Publisher);
 
                    mf.myListView2.Tag = "Title";
                    mf.myListView2.Items.Add(lvi);  // Add the list items to the ListView
                }

Open in new window

0
ssflynnCommented:
What is the declaration for mf.myListView2?  

Is myListView2 a public property?
0
rmmarshAuthor Commented:
myListView2 is public... (        public myListView myListView2;)  <- taken from mainform.designer.cs

0
rmmarshAuthor Commented:
I have figured it out myself:  if I pass the listview to the class method, I can get around the addressability propblems.
Thanks everyone for your help...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.