当我隐藏partiuclar列时,我不想隐藏日期和会话如何验证 [英] When i hide the partiuclar column i dont want to hide the Date and session how to validate
问题描述
当我隐藏特定列时,我不想在数据网格视图中隐藏日期和会话。
如何验证。
隐藏按钮代码如下;
when i hid the particular column i don''t want to hid the date and session in data grid view.
for that how to validate.
Hide button code as follows;
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 CK VB GS CMK UNNI
1 // 2013 1
当我点击隐藏按钮时,在该列值中验证工作正常。没问题。
但是我不要总是在数据网格视图中隐藏DATE和SESSION列。
用于验证如何编写代码。
Output as follows; Hide(Button)
DATE SESSION RK Mk CK VB GS CMK UNNI
1//2013 1
in that when i click the hide button,in that column values is there that validation is working fine. no problem.
But i don''t to hide the DATE and SESSION Column always in data grid view.
for that validation how to write the code.
推荐答案
void HideButton_Click(object sender, EventArgs e)
{
DataGridViewColumn column
= datagridView.Columns[datagridView.CurrentCellAddress.X];
if(
column == _dateColumn
|| column == _sessionColumn
)
// Both mentioned columns shall not be hidden.
{
return;
}
if (MessageBox.Show("Are You sure, You want to Hide", "Hide confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
column.Visible = false;
}
}
这篇关于当我隐藏partiuclar列时,我不想隐藏日期和会话如何验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!