小编Mr.*_*r.B的帖子

C# - 基于零的字符串错误

我尝试登录时出现此错误.

索引(从零开始)必须大于或等于零且小于参数列表的大小.

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

    private void button1_Click(object sender, EventArgs e)
    {
        //string name = textBox1.Text;
        string.Format ("{0} {1}", "Best", "Regards");

        if (textBox1.Text == "Ryan" && textBox2.Text == "password")
        {
            MessageBox.Show(string.Format("Welcome {1}" ));
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

c# string zero

-3
推荐指数
2
解决办法
778
查看次数

标签 统计

c# ×1

string ×1

zero ×1