public NewModPropNewForm(NewModForm modform, ListViewItem listViewItem) { InitializeComponent(); Modform = modform; WorkingListViewItem = listViewItem; // Clears all items inside of GroupComboBox. GroupComboBox.Items.Clear(); // Adds all groups from the ListView into GroupComboBox. foreach (ListViewGroup group in modform.GetListView().Groups) { GroupComboBox.Items.Add(group.Header); } // Adds "Add Group" to GroupComboBox so the user can create groups. GroupComboBox.Items.Add("Add Group"); GroupComboBox.SelectedIndex = 0; Text = "New Property"; if (listViewItem != null) { Text = "Edit Property"; label1.Text = "Edit Property: " + listViewItem.Text; TypeComboBox.Text = listViewItem.Tag as string; textBox1.Text = listViewItem.Text; GroupComboBox.SelectedIndex = modform.GetListView().Groups.IndexOf(listViewItem.Group); AddButton.Text = "Update"; ValueTextBox.Select(); UpdateType(); // Parses the text. switch (listViewItem.Tag) { case "Integer": if (listViewItem.SubItems[1].Text.Length > 0) { ValueNumericUpDown.Value = int.Parse(listViewItem.SubItems[1].Text); } break; case "Boolean": if (listViewItem.SubItems[1].Text.Length > 0) { ValueCheckBox.Checked = bool.Parse(listViewItem.SubItems[1].Text); } break; default: ValueTextBox.Text = listViewItem.SubItems[1].Text.Replace("\\n", "\r\n"); break; } } }