标签:sharp highlight har length csharp cells cell sys ima
实现效果:

知识运用:
System.Collections命名空间下的ArrayList集合类的Add()方法
使用了 DataGridView 控件
实现代码:
private void Form1_Load(object sender, EventArgs e)
{
ArrayList list_StudentInfo = new ArrayList();
string students="";
string[] arr_student, arr_studentinfo;
list_StudentInfo.Add("张三 男 23");
list_StudentInfo.Add("李四 女 18");
list_StudentInfo.Add("王五 男 21");
list_StudentInfo.Add("朱六 男 20");
list_StudentInfo.Add("小七 女 22");
foreach(string str in list_StudentInfo){
students += str+";";
}
arr_studentinfo = students.Split(‘;‘);
dataGridView1.Rows.Add(5);
for (int i = 0; i < arr_studentinfo.Length-1;i++ ) //注意Length-1
{
arr_student = arr_studentinfo[i].Split(‘ ‘);
dataGridView1.Rows[i].Cells[0].Value=arr_student[0];
dataGridView1.Rows[i].Cells[1].Value=arr_student[1];
dataGridView1.Rows[i].Cells[2].Value = arr_student[2];
}
}
标签:sharp highlight har length csharp cells cell sys ima
原文地址:https://www.cnblogs.com/feiyucha/p/10068306.html