We have a program, it is a game, but we just started with the start menu and the character select, my friend said. we are a 4 people group for this school project in programming, he said that he wants to connect the character pictureboxes to the button so that when the player chose his/her character it will be the one that gets chosen as a character for the game. but we tried to fix and find the solution for the problem but we can't find any solution that can help us. everything in the code works fine but whenever we call the method it gives us the problem "Member 'Program.selectform()' cannot be accessed with an instance reference, , qualify it with a type name instead" we we're not sure what this means but not we're not able to figure it out in other posts. Any help would be very much appreciated as we really want this project to be a success, thank you.
static void Main(string[] args)
{
//Main Menu Window/Form Properties
Form StartMenuWindow = new Form();
StartMenuWindow.Text = "Start Menu";
StartMenuWindow.StartPosition = FormStartPosition.CenterScreen;
StartMenuWindow.Width = 800;
StartMenuWindow.Height = 500;
StartMenuWindow.Text = "Start Menu";
StartMenuWindow.BackgroundImage = Image.FromFile(@"Essentials\Bg 1.png");
StartMenuWindow.FormBorderStyle = FormBorderStyle.FixedSingle;
//Group Two Title Properties (under the game title)
GroupLab = new Label();
GroupLab.Font = new Font("Stay Pixel", 15, FontStyle.Bold);
GroupLab.BackColor = System.Drawing.Color.Transparent;
GroupLab.ForeColor = Color.Maroon;
GroupLab.Text = "Made by Group two";
GroupLab.Size = new Size(196, 34);
GroupLab.Location = new Point(298, 418);
GroupLab.Parent = StartMenuWindow;
//Game Title Properties
GameTitle = new Label();
GameTitle.Font = new Font("Stay Pixel", 71, FontStyle.Bold);
GameTitle.BackColor = System.Drawing.Color.Transparent;
GameTitle.ForeColor = Color.Maroon;
GameTitle.Text = "Student Survivors";
GameTitle.Size = new Size(774, 154);
GameTitle.Location = new Point(20, 33);
GameTitle.Parent = StartMenuWindow;
//Start Button Properties
Button BtnStart = new Button();
BtnStart.Font = new Font("Stay Pixel", 36,FontStyle.Bold);
BtnStart.BackColor = Color.SlateGray;
BtnStart.Text = "Start";
BtnStart.Location = new System.Drawing.Point(108, 260);
BtnStart.Width = 250;
BtnStart.Height = 100;
BtnStart.Parent = StartMenuWindow;
BtnStart.Click += new System.EventHandler(BtnStart_Click);
//Exit Button Properties
Button BtnExit = new Button();
BtnExit.Font = new Font("Stay Pixel", 36, FontStyle.Bold);
BtnExit.BackColor = Color.SlateGray;
BtnExit.Text = "Exit";
BtnExit.Location = new System.Drawing.Point(436, 260);
BtnExit.Width = 250;
BtnExit.Height = 100;
BtnExit.Parent = StartMenuWindow;
BtnExit.Click += new System.EventHandler(BtnExit_Click);
StartMenuWindow.ShowDialog();
}
static void selectform()
{
//Form Properties (CHARACTER SELECT WINDOW/FORM)
Form select = new Form();
select.Text = "Start Menu";
select.StartPosition = FormStartPosition.CenterScreen;
select.Width = 800;
select.Height = 500;
select.Text = "Start Menu";
select.BackgroundImage = Image.FromFile(@"Essentials\Bg 2.png");
select.FormBorderStyle = FormBorderStyle.FixedSingle;
//Character Select Title (Choose your Student)
ChooseTitle = new Label();
ChooseTitle.Font = new Font("Stay Pixel", 48, FontStyle.Bold);
ChooseTitle.BackColor = System.Drawing.Color.Transparent;
ChooseTitle.ForeColor = Color.Maroon;
ChooseTitle.Text = "Choose your Student";
ChooseTitle.Width = 589;
ChooseTitle.Height = 48;
ChooseTitle.Location = new Point(103, 9);
ChooseTitle.Parent = select;
//Character One Properties
Choosechar1 = new Label();
Choosechar1.Font = new Font("Stay Pixel", 20, FontStyle.Bold);
Choosechar1.BackColor = System.Drawing.Color.Transparent;
Choosechar1.ForeColor = Color.Maroon;
Choosechar1.Text = "The Normal";
Choosechar1.Width = 17;
Choosechar1.Height = 104;
Choosechar1.Size = new Size(153, 43);
Choosechar1.Location = new Point(17, 104);
Choosechar1.Parent = select;
//Character Two Properties
Choosechar2 = new Label();
Choosechar2.Font = new Font("Stay Pixel", 20, FontStyle.Bold);
Choosechar2.BackColor = System.Drawing.Color.Transparent;
Choosechar2.ForeColor = Color.Maroon;
Choosechar2.Text = "The Buff";
Choosechar2.Size = new Size(115, 43);
Choosechar2.Location = new Point(244, 104);
Choosechar2.Parent = select;
//Character Three Properties
Choosechar3 = new Label();
Choosechar3.Font = new Font("Stay Pixel", 20, FontStyle.Bold);
Choosechar3.BackColor = System.Drawing.Color.Transparent;
Choosechar3.ForeColor = Color.Maroon;
Choosechar3.Text = "The Eternal";
Choosechar3.Size = new Size(154, 43);
Choosechar3.Location = new Point(416, 104);
Choosechar3.Parent = select;
//Character Four Properties
Choosechar4 = new Label();
Choosechar4.Font = new Font("Stay Pixel", 20, FontStyle.Bold);
Choosechar4.BackColor = System.Drawing.Color.Transparent;
Choosechar4.ForeColor = Color.Maroon;
Choosechar4.Text = "The Ascendant";
Choosechar4.Size = new Size(189, 43);
Choosechar4.Location = new Point(597, 104);
Choosechar4.Parent = select;
//CHARACTER PROPERTIES
//Character One
Charone = new PictureBox();
Charone.Image = Image.FromFile("lj.gif");
Charone.Location = new System.Drawing.Point(20, 150);
Charone.Size = new System.Drawing.Size(150, 180);
Charone.SizeMode = PictureBoxSizeMode.Zoom;
Charone.TabIndex = 0;
Charone.TabStop = false;
//Charone.MouseClick += new MouseEventHandler(Charone_Click);
Charone.Parent = select;
//Character Two
Chartwo = new PictureBox();
Chartwo.Image = Image.FromFile("riane.gif");
Chartwo.Location = new System.Drawing.Point(220, 150);
Chartwo.Size = new System.Drawing.Size(150, 180);
Chartwo.SizeMode = PictureBoxSizeMode.Zoom;
Chartwo.TabIndex = 1;
Chartwo.TabStop = false;
//Chartwo.MouseClick += new MouseEventHandler(Chartwo_Click);
Chartwo.Parent = select;
//Chracter Three
Charthree = new PictureBox();
Charthree.Image = Image.FromFile("cjay.gif");
Charthree.Location = new System.Drawing.Point(420, 150);
Charthree.Size = new System.Drawing.Size(150, 180);
Charthree.SizeMode = PictureBoxSizeMode.Zoom;
Charthree.TabIndex = 2;
Charthree.TabStop = false;
//Charthree.MouseClick += new MouseEventHandler(Charthree_Click);
Charthree.Parent = select;
//Character Four
Charfour = new PictureBox();
Charfour.BackColor = System.Drawing.Color.DimGray;
Charfour.Image = Image.FromFile("jr.gif");
Charfour.Location = new System.Drawing.Point(615, 150);
Charfour.Name = "Charfour";
Charfour.Size = new System.Drawing.Size(150, 180);
Charfour.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
Charfour.TabIndex = 3;
Charfour.TabStop = false;
//Charfour.Click += new System.EventHandler(Charfour_Click);
Charfour.Parent = select;
//START BUTTON PROPERTIES
Button BtnStartSelect = new Button();
BtnStartSelect.Font = new Font("Stay Pixel", 36, FontStyle.Bold);
BtnStartSelect.BackColor = Color.SlateGray;
BtnStartSelect.Text = "Start";
BtnStartSelect.Location = new System.Drawing.Point(297, 351);
BtnStartSelect.Width = 220;
BtnStartSelect.Height = 77;
BtnStartSelect.Parent = select;
select.ShowDialog();
}
static void BtnStart_Click(object sender, EventArgs e)
{
selectform();
Program p = new Program();
p.selectform();
}
private static void BtnExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
} '''