I'm a C# newbie. I'm getting the above error in the section of code below:
namespace SSTW
{
public partial class FormGameType : Form
{
public FormGameType()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
InitVariables.GameType = 1; //Regular game
}
}
}
The other relevant code snippets are:
namespace SSTW
{
class InitVars
{
public int GameType{ get; set; }
}
}
namespace SSTW
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitVars InitVariables = new InitVars();
Any help would be appreciated.
The name 'InitVariables' does not exist in the current context
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 13, 2010, 8:03 AM EST
InitVars InitVariables = new InitVars();
like
namespace SSTW
{
public partial class FormGameType : Form
{
InitVars InitVariables = new InitVars();
public FormGameType()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
InitVariables.GameType = 1; //Regular game
}
}
}
Thanks.....