使用chsarp从数据网格视图中隐藏特定列名称,以便进行验证 [英] Hide the particlar column name from data grid view using chsarp for that validation is needed

查看:81
本文介绍了使用chsarp从数据网格视图中隐藏特定列名称,以便进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据网格视图中隐藏特定的列名。



代码如下;



i有一个名为Hide的按钮。

i hide the particular column name from data grid view.

Code as follows;

i have one button called Hide.

private void Btn_Hide_Click(object sender, EventArgs e)
        {
            //confirmation to Hide the column
            datagridView.Columns[datagridView.CurrentCellAddress.X].Visible = false;
        }

当我点击隐藏按钮时,partiuclar列将隐藏在数据网格视图中。



隐藏到特定列之前在数据网格视图中,用户必须确认假设该列值是否有待检查。



如何验证。请发送代码。

when i click the Hide button that partiuclar column will hide in data grid view.

Before Hiding to the particular column in data grid view user have to confirm suppose in that column values are there to check.

for that how to validate.please send the code.

推荐答案





只需弹出一个确认消息框。



ASP [ ^ ] Windows [ ^ ]


查看 Window.DialogResult [<小时ef =http://msdn.microsoft.com/en-us/library/system.windows.window.dialogresult.aspxtarget =_ blanktitle =New Window> ^ ]

Check out Window.DialogResult[^]
private void Btn_Hide_Click(object sender, EventArgs e)
{
  DialogResult dialogResult = MessageBox.Show("Sure", "Some Title",    MessageBoxButtons.YesNo);
  if(dialogResult == DialogResult.Yes)
  {
    //confirmation to Hide the column
            datagridView.Columns[datagridView.CurrentCellAddress.X].Visible = false;
  }
  else if (dialogResult == DialogResult.No)
  {
    //do something else
  }
}





祝你好运,

OI



Good luck,
OI


这篇关于使用chsarp从数据网格视图中隐藏特定列名称,以便进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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