我有一个登录窗口,在组合框中有2个部分,用户必须选择他/她必须继续前进的部分。因此,当用户从组合框中选择on选项并输入用户名和密码并单击login时,他将被移至特定表单。
登录表单的图像:-https://drive.google.com/open?id=19fh710m-9kZU9xXYUFWse8z5d5QZyKMB
代码:
namespace Billing_Beta
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void Login_Load(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
答案 0 :(得分:0)
检查所选值:
if (e.SelectedItem == ?)
打开新表格
new MyForm().Show();
答案 1 :(得分:0)
protected voud btnLogin_Click (object sender, EventArgs e)
{
int status = Convert.ToInt32(cbLogin.Value);
if (status == 1)
{
Form1 frm1 = new Form1(); //Form 1 the name of the form which you want to open.
frm1.Show();
this.Hide()
}
else if (status == 2)
{
From2 frm2 = new Form2(); //Form 2 the name of the form which you want to open.
frm2.Show();
this.Hide();
}