c# login Screen Error
- by Kumu
The type or namespace name 'Login' could not be found (are you missing a using directive or an assembly reference?)
This error displays according to the MainMenu of my system.
The following code describes the MainMenu source code of my system.
Login login; is the error place which system shows,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FootballLeague
{
public partial class MainMenu : Form
{
FootballLeagueDatabase footballLeagueDatabase;
Game game;
Team team;
**Login login;**
public MainMenu()
{
InitializeComponent();
changePanel(1);
}
public MainMenu(FootballLeagueDatabase footballLeagueDatabaseIn)
{
InitializeComponent();
footballLeagueDatabase = footballLeagueDatabaseIn;
}
//FootballLeagueDatabase footballLeagueDatabase = new FootballLeagueDatabase();
private void Form_Loaded(object sender, EventArgs e)
{
}
private void gameButton_Click(object sender, EventArgs e)
{
int option = 0;
changePanel(option);
}
private void scoreboardButton_Click(object sender, EventArgs e)
{
int option = 1;
changePanel(option);
}
private void changePanel(int optionIn)
{
gamePanel.Hide();
scoreboardPanel.Hide();
string title = "Football League System";
switch (optionIn)
{
case 0:
gamePanel.Show();
this.Text = title + " - Game Menu";
break;
case 1:
scoreboardPanel.Show();
this.Text = title + " - Display Menu";
break;
}
}
private void logoutButton_Click(object sender, EventArgs e)
{
login = new Login();
login.Show();
this.Hide();
}
and I have the Form class called Login.cs and the following code displays that class.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FootballLeagueSystem
{
public partial class Login : Form
{
MainMenu menu;
public Login()
{
InitializeComponent();
}
private void administratorLoginButton_Click(object sender, EventArgs e)
{
string username1 = "08247739";
string password1 = "08247739";
if ((userNameTxt.Text.Length) == 0)
MessageBox.Show("Please enter your username!");
else if ((passwordTxt.Text.Length) == 0)
MessageBox.Show("Please enter your password!");
else if (userNameTxt.Text.Equals("") || passwordTxt.Text.Equals(""))
MessageBox.Show("Invalid Username or Password!");
else
{
if (this.userNameTxt.Text == username1 && this.passwordTxt.Text == password1)
MessageBox.Show("Welcome Administrator!", "Administrator Login");
menu = new MainMenu();
menu.Show();
this.Hide();
}
}
private void managerLoginButton_Click(object sender, EventArgs e)
{
{
string username2 = "1111";
string password2 = "1111";
if ((userNameTxt.Text.Length) == 0)
MessageBox.Show("Please enter your username!");
else if ((passwordTxt.Text.Length) == 0)
MessageBox.Show("Please enter your password!");
else if (userNameTxt.Text.Equals("") && passwordTxt.Text.Equals(""))
MessageBox.Show("Invalid Username or Password!");
//menu = new MainMenu();
//menu.Hide();
//this.Close();
else
{
if (this.userNameTxt.Text == username2 && this.passwordTxt.Text == password2)
MessageBox.Show("Welcome Manager!", "Manager Login");
menu = new MainMenu();
menu.Show();
//menu.HideTab();
this.Hide();
}
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Please can you someone explain me where is the error is?