export button now only available if any user is selected
This commit is contained in:
33
Form1.cs
33
Form1.cs
@@ -48,13 +48,18 @@ namespace it_projekt
|
||||
this.dataGrid.Rows.Add(person.Id, person.Firstname, person.Lastname, person.Department_short, person.Department_long, person.CreationDate, false);
|
||||
}
|
||||
this.loginBtn.Enabled = false;
|
||||
this.exportBtn.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private System.EventHandler test()
|
||||
{
|
||||
this.exportBtn.Enabled = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void export(string Filter, string FileName)
|
||||
@@ -120,5 +125,31 @@ namespace it_projekt
|
||||
{
|
||||
|
||||
}
|
||||
private void DataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
//Check to ensure that the row CheckBox is clicked.
|
||||
if (e.RowIndex >= 0 && e.ColumnIndex == 6)
|
||||
{
|
||||
//Reference the GridView Row.
|
||||
DataGridViewRow row = dataGrid.Rows[e.RowIndex];
|
||||
|
||||
//Set the CheckBox selection.
|
||||
row.Cells[6].Value = Convert.ToBoolean(row.Cells[6].EditedFormattedValue);
|
||||
exportBtn.Enabled = false;
|
||||
//If CheckBox is checked, display Message Box.
|
||||
if (Convert.ToBoolean(row.Cells[6].Value))
|
||||
{
|
||||
exportBtn.Enabled = true;
|
||||
}
|
||||
foreach (DataGridViewRow r in dataGrid.Rows)
|
||||
{
|
||||
if (Convert.ToBoolean(r.Cells[6].Value))
|
||||
{
|
||||
exportBtn.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user