/// <summary> /// after the user presses enter the text is converted to a name /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OriginalName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (int)Keys.Enter) { name = new Name(OriginalName.Text); list = list + name; List.Items.Add(name); this.AmountOfNamesInList.Text = " Items in list:" + Convert.ToString(List.Items.Count); HasChanged = true; OriginalName.Clear(); } }
/// <summary> /// Upon clicking a item in the list the text boxes are filled with relevant info /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void List_Click(object sender, EventArgs e) { if (List.SelectedItem != null) { OriginalName.Clear(); LastName.Clear(); RestOfName.Clear(); Suffix.Clear(); try { this.OriginalName.Text = name.OriginalName; this.LastName.Text = name.Last; this.RestOfName.Text = name.Rest; this.Suffix.Text = name.Suffix; } catch (NullReferenceException) { } } }
/// <summary> /// When the user clicks in this test box it is cleared /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OriginalName_Enter(object sender, EventArgs e) { OriginalName.Clear(); }