Skip to content

Commit

Permalink
Simplify this function
Browse files Browse the repository at this point in the history
  • Loading branch information
Morilli committed Jun 16, 2024
1 parent bbd21eb commit 4cfaf74
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,11 @@ private void AddButton_Click(object sender, EventArgs e)

private void btnRemove_Click(object sender, EventArgs e)
{
//ToDo:
//Make this better?
//We need to have i at 1 and not zero because Controls Count doesn't start at zero (sort of)
var i = 1;
//For Each Control box we have, loop
foreach (Control ctrl in FileSelectorPanel.Controls)
if (FileSelectorPanel.Controls.Count > 0)
{
//if we are at the last box, then remove it.
if ((i == FileSelectorPanel.Controls.Count))
{
ctrl.Dispose();
}
//One to our looper
i++;
FileSelectorPanel.Controls[^1].Dispose();
Recalculate();
}

Recalculate();
}

private void FileSelector_NameChanged(object sender, EventArgs e)
Expand Down

0 comments on commit 4cfaf74

Please sign in to comment.