隐藏单元格

private void button1_Click(object sender, EventArgs e)
{
string mystr = button1.Text;
if (mystr == "隐藏最后一列")
{
//当前列
dataGridView1.Columns[5].Visible = false;
mystr = "显示部门列";
button1.Text = mystr;
}
else if(button1.Text=="显示部门列")
{
//当前列
dataGridView1.Columns[5].Visible=true;
mystr = "隐藏最后一列";
button1.Text = mystr;
}

posted @ 2018-11-09 08:36  锦大大的博客呀!  阅读(130)  评论(0编辑  收藏  举报