I\'m struggling to get a class from a different form without making it static, here\'s what I want to do:
//First form
public partial class SetupScreen : For
You could pass a reference of your first form to your second form, or (what I would do), create a public Battleship
property on your second form and pass your object that way.
//First form
public partial class SetupScreen : Form
{
Control myObject;
public Battleship myBattleship;
public SetupScreen()
{
InitializeComponent();
//Create Class Object
myBattleship = new Battleship();
Form gameForm = new GameScreen(); // New form object
gameForm.MyBattleship = myBattleship; // Set property
gameForm.Show(); // Show form
}
}
//Second form
public partial class GameScreen : Form
{
Control myObject;
Battleship fredBattleship;
public BattleShip MyBattleship { set; get; }
public GameScreen()
{
InitializeComponent();
}
}