serial port Invoke call

hi -
I'm using VS2010 and .net4.0 with a windows form applications.  
I have successfully used the following code to handle the return data from a serial device to pass the received data to the original thread:

void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
int numBytesRead = port.Read(receiveBuffer, 0, 200);
                    UpdateDisplay ud = new UpdateDisplay(UpdateDisplayMethod);

                    if (numBytesRead != 0)
                    {
                        Invoke(ud, new object[] { receiveBuffer, numBytesRead });

                    }
}

I have a slightly different flavor of an application where I create a class which the above code is embedded in. when I try to paste in the invoke code, VS2010 flags it with this error:
Error      29 Cannot access a non-static member of outer type 'System.Windows.Forms.Control' via nested type 'Control_Editor.CT_UI_Control.MatrixDisplay'

 the windows form code creates the class with this code:
MatrixModule = new MatrixDisplay(portNameitem);
I don't understand why i'm getting the error, and more importantly, I don't know what to do about it.
thanks,
jdcoburnAsked:
Who is Participating?
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.

Miguel OzSoftware EngineerCommented:
A bit hard to say without looking at your class declaration and method signature.
Please post these details tog et the whole picture.

As an educated guess I will say that your class is defining a nested inner class and trying to access the container(outer) class as shown here (Answer from Stanley).
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
jdcoburnAuthor Commented:
yes - you were correct. it was a typo that I didn't catch until after I had posted this.
thanks,
0
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.