Private Sub cmbEmployeeName_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cmbEmployeeName.MouseDown
If cmbEmployeeName.MouseButtons = cmbEmployeeName.MouseButtons.Right Then
cmbEmployeeName.DropDownStyle = ComboBoxStyle.DropDown
lblEmployeePhon.Visible = False
txbPhone.Visible = False
lblDateOfHire.Visible = False
DateTimePicker1.Visible = False
lblPTO.Visible = False
txbPTO.Visible = False
lblPTORemaining.Visible = False
txbESRemainingPTO.Visible = False
btnDeleteEmployee.Visible = False
lblHours.Visible = False
lblHours2.Visible = False
lblClicktoDelete.Visible = False
Label4.Visible = False
cmbEmployeeName.SelectedIndex = "-1"
If cmbEmployeeName.Text <> "" Then
cmbEmployeeName.SelectedIndex = "-1"
End If
End If
End Sub
Private Sub btnAddNewEmployee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewEmployee.Click
Dim NewRow As DataRow = dataset2.Tables("employees").NewRow
NewRow("Name") = cmbEmployeeName.Text
NewEmployee = cmbEmployeeName.Text
Dim trim As Integer
Dim length As Integer
Dim removed As Integer
length = cmbEmployeeName.Text.Length
trim = cmbEmployeeName.Text.IndexOf(" ")
removed = length - trim
NewRow("LastName") = cmbEmployeeName.Text.Substring(trim)
NewRow("FirstName") = cmbEmployeeName.Text.Remove(trim, removed)
NewRow("Phone") = "Enter Employee Phone"
NewRow("BeginningPTO") = 0
NewRow("DateHired") = Date.Now
dataset2.Tables("Employees").Rows.Add(NewRow)
cmbEmployeeName.DropDownStyle = ComboBoxStyle.DropDownList
lblEmployeePhon.Visible = True
txbPhone.Visible = True
lblDateOfHire.Visible = True
DateTimePicker1.Visible = True
lblPTO.Visible = True
txbPTO.Visible = True
lblPTORemaining.Visible = True
txbESRemainingPTO.Visible = True
btnDeleteEmployee.Visible = True
lblHours.Visible = True
lblHours2.Visible = True
lblClicktoDelete.Visible = True
Label4.Visible = True
Me.BindingContext(dataset2, "Employees").Position = cmbEmployeeName.FindStringExact(NewEmployee)
cmbEmployeeName.SelectedIndex = cmbEmployeeName.FindStringExact(NewEmployee)
MessageBox.Show("To complete the addition of this new employee, enter the appropriate information in the data fields that are now available.", "Complete New Employee Setup", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub