表格在当前上下文中不存在

时间:2018-05-11 20:08:06

标签: c# winforms

单击登录按钮后,我想隐藏登录表单并显示登录确认表单以及包含侧栏的第二个表单。当我点击按钮时,我收到一个"在当前上下文中不存在"错误。

public partial class Dashboad : Form
{
    public Dashboad()
    {
        InitializeComponent();
    }

    private int imageNumber = 1;

    public void LoadNextLoad()
    {
        if (imageNumber == 10)
        {
            imageNumber = 1;
        }
        slider.ImageLocation = string.Format(@"images/{0}.jpg", imageNumber);
        imageNumber++;
    }

    private void slideTimer_Tick(object sender, EventArgs e)
    {
        LoadNextLoad();
    }

    private void Dashboad_Load(object sender, EventArgs e)
    {

    }
    private void LeftPanel_Paint(object sender, PaintEventArgs e)
    {

    }
    private void BodyPanel_Paint(object sender, PaintEventArgs e)
    {

    }
}

public partial class loginForm : Form
{
    public loginForm()
    {
        InitializeComponent();
    }
    private void btnlogin_Click(object sender, EventArgs e)
    {
        this.Hide();
        SideBarMenu menu = new SideBarMenu();
        menu.TopLevel = false;
        menu.FormBorderStyle = FormBorderStyle.None;
        menu.Dock = DockStyle.Fill;
        LeftPanel.Controls.Clear();
        LeftPanel.Controls.Add(menu);
        menu.Visible = true;
    }
}

0 个答案:

没有答案