export button now only available if any user is selected
This commit is contained in:
3
Form1.Designer.cs
generated
3
Form1.Designer.cs
generated
@@ -60,6 +60,7 @@ namespace it_projekt
|
||||
//
|
||||
// exportBtn
|
||||
//
|
||||
this.exportBtn.Enabled = false;
|
||||
this.exportBtn.Location = new System.Drawing.Point(480, 80);
|
||||
this.exportBtn.Name = "exportBtn";
|
||||
this.exportBtn.Size = new System.Drawing.Size(75, 23);
|
||||
@@ -119,7 +120,7 @@ namespace it_projekt
|
||||
this.dataGrid.RowTemplate.Height = 25;
|
||||
this.dataGrid.Size = new System.Drawing.Size(743, 225);
|
||||
this.dataGrid.TabIndex = 7;
|
||||
this.dataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGrid_CellContentClick);
|
||||
this.dataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellClick);
|
||||
//
|
||||
// Id
|
||||
//
|
||||
|
||||
33
Form1.cs
33
Form1.cs
@@ -48,7 +48,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +56,12 @@ namespace it_projekt
|
||||
|
||||
}
|
||||
|
||||
private System.EventHandler test()
|
||||
{
|
||||
this.exportBtn.Enabled = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void export(string Filter, string FileName)
|
||||
{
|
||||
List<Person> markedUsers = new List<Person>();
|
||||
@@ -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