I am trying to create an object of a class, but it doesn't seem to work, I can't help but think I am looking at this from a JAVA perspective:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
PortChecks PortCheckObject = new PortChecks();
}
private void testCheck_Click(object sender, EventArgs e)
{
PortCheckObject.MyMethod();
}
I can error when using the PortCheckObject to call my method MyMethod
(PortChecks is the class name)
PortCheckObjectis a local variable in the contructor of Form1 that you cannot access fromtestCheck_Click. This would be the same even in Java.