using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace jimi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string x = string.Empty, y = string.Empty;
string[,] pwd = { {"0","1","2","3","4","5","6","7","8","9"},
{"q","w","e","r","t","y","u","i","o","p"},
{"[","]","a","s","d","f","g","h","j","k"},
{"l",";","'","\\","z","x","c","v","b","n"},
{"m",",",".","/","?",">","<","|",":","}"},
{"{","+","_","=","-",")","(","*","&","^"},
{"%","$","#","@","!","~","A","S","D","F"},
{"G","H","J","K","L","P","O","I","U","Y"},
{"T","E","W","Q","Z","X","C","V","B","N"},
{"M"," ","","","","","","","",""}
};
x = textBox1.Text;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (Convert.ToString( pwd[i,j]) ==Convert.ToString( x[i]))
{
y +=Convert.ToString(i);
y +=Convert.ToString(j);
}
}
}
textBox2.Text = y;
}
}
}
执行后在TextBox1中输入123之后按下按钮 有下面错误提示:
数组越界,索引超出数组界限;
怎么回事呢?
![]()