如何隐藏数据网格视图中的partiular列 [英] How to hide the partiular column in data grid view
本文介绍了如何隐藏数据网格视图中的partiular列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为hide的按钮。
当我点击该按钮时我想检查列值是否存在。
隐藏按钮代码如下;
i have one button called hide.
when i click that button i want to check in that column values are there.
Hide Button Code as follows;
private void Btn_Hide_Click(object sender, EventArgs e)
{
//confirmation to Hide the column
datagridView.Columns[datagridView.CurrentCellAddress.X].Visible = false;
}
输出如下;按钮(隐藏)
output as follows; Button(Hide)
Date Period RK Mk CK VK GS VB CM <br />
<br />
15/1/2013 1 tam(course)<br />
假设用户选择Mk列并单击隐藏按钮,用户想要检查Mk列值tam(course)是否存在。你想隐藏。
如何验证。
Suppose user select the Mk column and click the Hide Button,user want to check in that Mk column values tam(course) is there.do u want to hide.
for that how to validate.
推荐答案
它将询问用户的构造。只需按照以下简单步骤操作:
It will ask the user for conformation. Just follow the simple steps given below:
private void Btn_Hide_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are You sure, You want to Delete?", "Delete Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes){
datagridView.Columns[datagridView.CurrentCellAddress.X].Visible = false;
}
}
这篇关于如何隐藏数据网格视图中的partiular列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文