已解决 3楼5楼没有理解我得意思 不过还是感谢
我说的是从一个文档里面读取数据 =后的字符没有规律
static Label[] InputLable=new Label[16];
static string[] StrSub=new string[34];
static string[] StrLable = new string[32];
InputLable[0] = label0; InputLable[1] = label1; InputLable[2] = label2; InputLable[3] = label3;
InputLable[4] = label4; InputLable[5] = label5; InputLable[6] = label6; InputLable[7] = label7;
InputLable[8] = label8; InputLable[9] = label9; InputLable[10] = label10; InputLable[11] = label11;
InputLable[12] = label12; InputLable[13] = label13; InputLable[14] = label14; InputLable[15] = label15;
StreamReader InputParaReader;
InputParaReader = new StreamReader(@"C:\IOName.ini",Encoding.GetEncoding(936));
StrSub[0] = InputParaReader.ReadToEnd();
for (int i = 1; i < 34; i++)
{
StrSub[i] = StrSub[i - 1].Substring(StrSub[i - 1].IndexOf("\n") + 1, StrSub[i - 1].Length - StrSub[i - 1].IndexOf("\n") - 1);
}
for (int a = 1; a < 17; a++)
{
StrLable[a - 1] = StrSub[a].Substring(StrSub[a].IndexOf("=") + 1, StrSub[a].Length - StrSub[a + 1].Length - StrSub[a].IndexOf("=") - 1);
}
for (int i = 0; i < 16; i++)
{
InputLable[i].Text = StrLable[i].ToString();
}