I have a program that I'm trying to break into multiple files for proper coding and easy expansion in the future. I have a button that scans the computer for certain attributes, and as it scans, I want it to update a ListBox (lstBox)... I get errors because I don't think I'm laying it out correctly... My code is below:
That's how my code's setup now, and I get this error:
If i put the interface in the Form1, it responds with a different error, because of another file I have.
Scan.cs
Code:
namespace abc
{
public interface IObserver
{
void update();
}
}
Code:
namespace abc
{
public partial class Form1 : Form
{
....
class lstViewObserver : IObserver
{
public void update()
{
.... //Here is where it cannot access lstView.
}
}
}
That's how my code's setup now, and I get this error:
Code:
Error 5 Cannot access a non-static member of outer type 'abc.Form1' via nested type 'abc.Form1.lstViewObserver'
If i put the interface in the Form1, it responds with a different error, because of another file I have.
Scan.cs
Code:
namespace abc
{
public class Scan
{
...
public void RegisterObserver(IObserver observer)
{
...
}
}
}
Code:
Error 5 Cannot access a non-static member of outer type 'zives.Form1' via nested type 'zives.Form1.lstViewObserver' C:\Users\zivester\Documents\Visual Studio 2008\Projects\zives\zives\Form1.cs 259 17 zives