I know this is a noob error but I really can't discover why it's coming up as I am accessing an object that is set.
The xloc
and yloc
both being local variables.
gameBorder.FormInstance.tableLayoutPanel1.GetControlFromPosition(xloc, yloc).BackgroundImage = Properties.Resources.Image;
However this has been set within the form class:
namespace csharp_build
{
public partial class gameBorder : Form
{
public static gameBorder FormInstance;
public gameBorder()
{
FormInstance = this;
InitializeComponent();
}
}
}
Any idea why this happens? Would it be to do with the fact that the form class is referenced as gameBorder
, and that is what the constructor is called, and the name for the form class in the solution explorer is Form1.cs?
I know this is a noob problem and I do apolagize but any help would be greatly appreciated.