private void ShowAllocations(List <Statement> statements) { ViewPanel.Controls.Clear(); foreach (var statement in statements) { var statementAllocationControl = new StatementAllocationControl(statement) { Dock = DockStyle.Top }; statementAllocationControl.StatementTextBox.TextChanged += StatementAllocation_TextChanged; statementAllocationControl.StatementTextBox.SelectedIndexChanged += StatementAllocation_TextChanged; statementAllocationControl.RemoveButton.Click += RemoveButton_Click; ViewPanel.Controls.Add(statementAllocationControl); } }
private void newStatementToolStripMenuItem_Click(object sender, EventArgs e) { if (MonthlyAllocation == null) { MetroMessageBox.Show(this, "Select/Create Month"); return; } Statement statement = new Statement(MonthlyAllocation.Month, MonthlyAllocation.Year); MonthlyAllocation.Statements.Add(statement); StatementAllocationControl statementAllocation = new StatementAllocationControl(statement) { Dock = DockStyle.Top }; statementAllocation.StatementTextBox.TextChanged += StatementAllocation_TextChanged; statementAllocation.StatementTextBox.SelectedIndexChanged += StatementAllocation_TextChanged; statementAllocation.RemoveButton.Click += RemoveButton_Click; ViewPanel.Controls.Add(statementAllocation); }