111,120
社区成员
发帖
与我相关
我的任务
分享
if (str[i] == null || str[i].Equals(""))
{
continue;
}
if (bjMsg==null)
{
continue;
}
private void Form1_Load(object sender, EventArgs e)
{
string[] str= File.ReadAllLines("C:\\fy-zhf-tst\\1.text");
string bjMsg = null;
ComboBox comboBox1 = new ComboBox();
Form.ControlCollection clist = new ControlCollection(this);
for (int i = 0; i < str.Length; i++)
{
if (str[i] == null || str[i].Equals(""))
{
continue;
}
if (str[i].Equals("教师信息"))
{
Label lb1 = new Label();
lb1.Text = "教师信息";
bjMsg = "教师信息";
}
else if (str[i].Equals("学生信息"))
{
Label lb2 = new Label();
lb2.Text = "学生信息";
bjMsg = "学生信息";
}
else
{
if (bjMsg==null)
{
continue;
}
if (bjMsg.Equals("教师信息"))
{
Control[] txt=clist.Find("txt"+i,false);
txt[0].Text = str[i].Split('=')[1].ToString();
}
if (bjMsg.Equals("学生信息"))
{
comboBox1.Items.Insert(i, str[i].Split('=')[0].ToString());
string s2 = str[i].Split('=')[1].ToString();
Control[] txt = clist.Find("txt" + i, false);
txt[0].Text = str[i].Split('=')[1].ToString();
}
}
}
}