Beispiel #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text == "")
            {
                MessageBox.Show("Employee name not entered.");
                NameTextBox.Focus();
                return;
            }

            int IDNumber;

            try {
                IDNumber = int.Parse(IDTextBox.Text);
            } catch {
                MessageBox.Show("Invalid Employee ID.");
                IDTextBox.Focus();
                return;
            }

            myEmployee.NewEmployee(NameTextBox.Text, IDNumber, DepartmentTextBox.Text, PositionTextBox.Text);

            NameTextBox.Clear();
            IDTextBox.Clear();
            DepartmentTextBox.Clear();
            PositionTextBox.Clear();

            ListBox.Items.Add("Employee: " + IDNumber + " added!");

            NameTextBox.Focus();
        }
Beispiel #2
0
 void ClearTextBox()
 {
     NameTextBox.Clear();
     GenderTextBox.Clear();
     AgeTextBox.Clear();
     DepartmentTextBox.Clear();
 }