arraylist使用
/################# //去重复及字符串
DataGridView dgv_record;
ArrayList list = new ArrayList();
//去重复及字符串" "
for (int i = 0; i < dgv_record.Rows.Count; i++)
{
if (!list.Contains(dgv_record.Rows[i].Cells[cellname].Value.ToString().ToLower()))
{
if (!dgv_record.Rows[i].Cells[cellname].Value.ToString().ToLower().Equals(" "))
{
list.Add(dgv_record.Rows[i].Cells[cellname].Value.ToString());
}
}
}
DataGridView dgv_record;
ArrayList list = new ArrayList();
//去重复及字符串" "
for (int i = 0; i < dgv_record.Rows.Count; i++)
{
if (!list.Contains(dgv_record.Rows[i].Cells[cellname].Value.ToString().ToLower()))
{
if (!dgv_record.Rows[i].Cells[cellname].Value.ToString().ToLower().Equals(" "))
{
list.Add(dgv_record.Rows[i].Cells[cellname].Value.ToString());
}
}
}