无效的表达式术语'' [英] Invalid expression term ''
本文介绍了无效的表达式术语''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[删除了重复发布的代码 - 请参阅我尝试了什么?以下部分]
为你的帮助
我尝试过:
[removed duplicate posting of code - see "What have I tried?" section below]
ty for your helps
What I have tried:
private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
string username = "Vector";
int number = 89-2;
string password = "Vector" + number.ToString();
if ((txtusername.Text == username) && (txtpassword.Text == password))
this.Hide();
frm.Show();
MessageBox.Show("Welcome MR.Vector");
else
MessageBox.Show("Do not try to open this program");
this.Close();
}
推荐答案
您没有使用大括号在if / else语句中对多行代码进行分组。只有VB允许这样做。
C#'101' - 它应该是:
You are not using braces to group multiple lines of code in the if / else statement. Only VB allows this.
C# '101' - It should be:
if ((txtusername.Text == username) && (txtpassword.Text == password))
{
this.Hide();
frm.Show();
MessageBox.Show("Welcome MR.Vector");
}
else
{
MessageBox.Show("Do not try to open this program");
}
这篇关于无效的表达式术语''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文