this is class with methods
public partial class NewGame : Form
{
public NewGame()
{
InitializeComponent();
this.Icon = new Icon("Resources/iconG.ico");
comboBoxGenre.Items.AddRange(Enum.GetNames(typeof(Game.Genre)));
}
public string GetGameName()
{
return txtbxGameName.Text.Trim();
}
public int GetGenreSelector()
{
return comboBoxGenre.SelectedIndex;
}
}
this is my main form
private void addGameToolStripMenuItem_Click(object sender, EventArgs e)
{
Form newGame = new NewGame();
newGame.ShowDialog(this);
if (newGame.DialogResult==DialogResult.OK)
{
string gameName = newGame.GetGameName(); //this part doesn't work
}
}
i got a error message:
Error 1
'System.Windows.Forms.Form' does not contain a definition for 'GetGameName' and no extension method 'GetGameName' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?)
few weeks earlier i wrote similar code and it worked flawlessly.