在隐藏特定列之前想要检查那个列值是否有你要清除 [英] Before hiding the specific column want to check in that column values are there u wan to clear

查看:52
本文介绍了在隐藏特定列之前想要检查那个列值是否有你要清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

隐藏按钮代码如下;



Hide button code as follows;

private void Btn_Hide_Click(object sender, EventArgs e)
       {
 if (MessageBox.Show("Are You sure, You want to Hide?", "Hide confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
           {
               datagridView.Columns[datagridView.CurrentCellAddress.X].Visible = false;
           }

       }





来自上面的代码,当我点击隐藏按钮消息弹出窗口你确定,你想要隐藏吗?



但是在此消息显示之前,

该列的课程是如果用户说是清除项目并隐藏特定列,你想要清除。



输出如下;

隐藏(按钮) )



日期会议RK Mk GS VB



2013年1月7日1 tam(课程)

2/7/2013 2



当我点击隐藏按钮验证该RK列tam值是否存在时。



如果用户说清楚tam课程然后隐藏专栏,你首先要清除tam(课程)。



如何验证清除tam课程



from the above code when i click the hide button the message popups Are You sure, You want to Hide?.

but before this message shows,
for that column the course is there do u want to clear if user says yes clear the item and hide the particular column.

Output as follows;
Hide (Button)

Date Session RK Mk GS VB

1/7/2013 1 tam (course)
2/7/2013 2

when i click the hide button validate for that RK column tam value is there.

first do u want to clear the tam (course) if user says yes clear the tam course and then hide the column.

how to validate to clear the tam course

推荐答案

我不太明白你的问题,但这里是一个代码snipp et,这是你要找的吗?



I dont quite understand your question but here is a code snippet, is this what you were looking for?

private void button1_Click(object sender, EventArgs e)
{
     if (string.IsNullOrEmpty(dataGridView1.CurrentRow.Cells["Column Name"].Value.ToString()))
     {
          if (MessageBox.Show("Are You sure, You want to Hide?", "Hide confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
          {
               dataGridView1.Columns[dataGridView1.CurrentCellAddress.X].Visible = false;
          }
     }
     else
     {
          if (MessageBox.Show("Are You sure you want to clear course?", "Clear Course", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
          {
               dataGridView1.Columns[dataGridView1.CurrentCellAddress.X].Visible = false;
          }
     }
}


这篇关于在隐藏特定列之前想要检查那个列值是否有你要清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆