TabControl
Hi,
This is what i though as well, but ran a little check on it after your post, unfortunatley this did not help.
I did create another 4 textbox's on the main form, and they wrote perfectley to the database, but when selecting them off the tabcontrol (or at least trying to) they crash.
I have attached the Sub "AddRecords", if you need any further information, i can zip the project and email it to you?
Once again, thank you for the help!!!
Text in red is yours
Text in green is commented out
Private Sub AddRecords()
' Create the mappings from the Application Fields to the Database.
' Consists of DropDown Combo's, Currency, Date, Numeric and Memo Fields.
Try
Dim Tabpage1 As New TabPage
Dim Tabpage2 As New TabPage
Dim Tabpage3 As New TabPage
Dim varID As New Integer
Dim VarAccount As String
Dim drw1 As DataRow = DsHollardPayroll1.Tables("HollardPayroll").NewRow
' Numeric Fields
' Me.TabControl1.Container.Add(txtAccount.Text = drw1("Account"))
' Me.TabControl1.Container.Add(txtID.Text = drw1("ID"))
' drw1("ID") = txtID.Text
' If txtID.Text = "" Then
' MsgBox("Please enter the Correct ID Number", MsgBoxStyle.OKOnly)
' Exit Try
' End If
' Count for TabPage1 - Employee Details
'TabControl1.varID = txtID.Text
'drw1("ID") = TabControl1.TabPages.IndexOf(Tabpage1) = txtID.Text
'drw1("EmployeeNumber") = TabControl1.TabPages.IndexOf(Tabpage1) = txtEmpNum.Text
'drw1("LeavePerYear") = TabControl1.TabPages.IndexOf(Tabpage1) =txtLeavePerYear.Text
'drw1("CostCode") = TabControl1.TabPages.IndexOf(Tabpage1) = txtCostCode.Text
'drw1("PostalCode") = TabControl1.TabPages.IndexOf(Tabpage1) = txtPostalCode.Text
'drw1("ResAddress") = TabControl1.TabPages.IndexOf(Tabpage1) = txtAddress.Text
'drw1("PostalAddress") = TabControl1.TabPages.IndexOf(Tabpage1) = txtPostalAddress.Text
'drw1("Email") = TabControl1.TabPages.IndexOf(Tabpage1) = txtEmail.Text
'drw1("SuperEmail") = TabControl1.TabPages.IndexOf(Tabpage1) = txtSupervisorEmail.Text
'drw1("Firstname") = TabControl1.TabPages.IndexOf(Tabpage1) = txtFirstName.Text
'drw1("CostCode") = TabControl1.TabPages.IndexOf(Tabpage1) = txtCostCode.Text
'drw1("id").TabControl1.TabPages.IndexOf(Tabpage1) = txtID.Text
'If TabControl1.TabIndex = "Tabpage1" Then
'MsgBox("1")
'drw1("id") = txtID.Text
'ElseIf TabControl1.TabIndex = "tabcontrol2" Then
' MsgBox("2")
'End If
drw1("ID") = Int64.Parse(txtID.Text)
drw1("employeenumber") = Int64.Parse(txtEmpNum.Text)
drw1("LeavePerYear") = Int64.Parse(txtLeavePerYear.Text)
drw1("ID") = txtID.Text
drw1("EmployeeNumber") = txtEmpNum.Text
drw1("LeavePerYear") = txtLeavePerYear.Text
drw1("CostCode") = txtCostCode.Text
drw1("PostalCode") = txtPostalCode.Text
drw1("ResAddress") = txtAddress.Text
drw1("PostalAddress") = txtPostalAddress.Text
drw1("Email") = txtEmail.Text
drw1("SuperEmail") = txtSupervisorEmail.Text
drw1("FirstName") = txtFirstName.Text
drw1("Surname") = txtSurname.Text
drw1("KnownAs") = txtKnownAs.Text
drw1("Initials") = txtInitials.Text
drw1("Paypoint") = txtPaypoint.Text
drw1("Manager") = txtManager.Text
drw1("JobTitle") = txtJobTitle.Text
drw1("TravelAllowance") = txtTravel.Text
drw1("HourlyTCC") = txtHourlyTCC.Text
drw1("MonthlyTCC") = txtMonthlyTCC.Text
drw1("PackageCar") = txtPackageCar.Text
drw1("BirthDate") = DateBDate.Text
drw1("GroupStartDate") = DateGStartDate.Text
drw1("GroupEndDate") = DateGEndDate.Text
drw1("cboEmployeeStatus") = cboBoxEmploymentStatus.Text
drw1("cboGender") = cboBoxGender.Text
drw1("cboGroup") = cboBoxGroup.Text
drw1("cboMaritalStatus") = cboBoxMaritalStatus.Text
drw1("cboTitle") = cboBoxTitle.Text
'
' Count for TabPage2 - Employee Details
'
drw1("LibertyMedSpouse") = txtLibertyMedSpouse.Text
drw1("LibertyMed") = txtLibertyMed.Text
drw1("Relationship") = txtRelationship.Text
drw1("KinName") = txtKinName.Text
drw1("KinSurname") = txtKinSurname.Text
drw1("cboFundSelect") = cboBoxFundSelect.Text
drw1("MedicalCondition") = txtMedicalConditions.Text
'
' Count for TabPage3 - Employee Details
'
drw1("Account") = txtAccount.Text
drw1("BranchCode") = txtBranchCode.Text
drw1("TAXNumber") = txtTaxNumber.Text
drw1("BankName") = txtBankName.Text
drw1("BranchName") = txtBranchName.Text
drw1("TaxOffice") = txtTaxOffice.Text
drw1("cboTaxStatus") = cboBoxTaxStatus.Text
'Auto Increment
drw1("AutoID") = Integer.MaxValue
DsHollardPayroll1.Tables("HollardPayroll").Rows.Add(drw1)
AddHandler OleDbDataAdapter1.RowUpdated, _
New OleDb.OleDbRowUpdatedEventHandler(AddressOf OnRowUpdated)
OleDbDataAdapter1.Update(DsHollardPayroll1, "HollardPayroll")
MsgBox("Updated", MsgBoxStyle.OKOnly)
Catch eAddRecords As Exception
MsgBox("Action Failed, Please try again")
End Try
End Sub