private void buttonAddLabel_Click(object sender, EventArgs e) { TextLayout layout = listBoxLayout.SelectedItem as TextLayout; if (layout == null) { MessageBox.Show("Please select a Layout to add this label to..."); return; } xperdex.classes.QueryNewName nn = new xperdex.classes.QueryNewName("New Label Name"); nn.ShowDialog(); if (nn.DialogResult == DialogResult.OK) { if (layout.AddLayout(nn.textBox1.Text)) { textPlacementLayoutEditor1.Refresh(); listBoxLabel.DataSource = null; listBoxLabel.DataSource = layout.placements; } } }