0
我是Visual Studio中的新手。
我收到有關此代碼的錯誤。參數1字符串到System.Windows.Forms.iwin32window
private void metroLink1_Click(object sender, EventArgs e)
{
if (metroTextBox1.Text=="admin" || metroTextBox2.Text=="123")
{
Form2 settingsForm = new Form2();
settingsForm.Show();
}
else
{
MetroMessageBox.Show("Invaild Username or Password", "Error!");
}
}
從MetroMessageBox.Show("Invaild Username or Password", "Error");
你會得到什麼錯誤信息?另外,我想你的意思是'&&'而不是'||'在你的if中。 – Jack
錯誤消息來自代碼的最後一行 - > MetroMessageBox.Show(「Invaild用戶名或密碼」,「錯誤」); < - –
您在'Show()'調用的第一個參數中缺少窗口的所有者。嘗試通過'this':'MetroMessageBox.Show(this,「Invaild Username or Password」,「Error!」)' – Jack