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?
 
rmmarshConnect With a Mentor Author 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
 
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
rmmarshAuthor Commented:
MyListView is public... 
0
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.