Private Sub TblCustomerBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.TblCustomerBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.CustomerDataDataSet)
End Sub
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomerDataDataSet.tblCustomer' table. You can move, or remove it, as needed.
Me.TblCustomerTableAdapter.Fill(Me.CustomerDataDataSet.tblCustomer)
End Sub
Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegister.Click
Try
TblCustomerBindingSource.EndEdit()
TblCustomerTableAdapter.Update(CustomerDataDataSet.tblCustomer)
MessageBox.Show("Registered successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Form5.Show()
Me.Hide()
Form5.TblReservationBindingSource.AddNew()
Form5.Label2.Text = Customer_IDTextBox.Text
Form5.Label3.Text = FirstNameTextBox.Text & " " & LastNameTextBox.Text
Catch ex As Exception
MessageBox.Show("Error")
End Try
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
FirstNameTextBox.Text = ""
LastNameTextBox.Text = ""
Contact_NoTextBox.Text = ""
Email_AddressTextBox.Text = ""
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Date_Of_RegistrationTextBox.Text = Format(Now, "MM/dd/yyyy, hh:mm:ss tt")
End Sub
当我尝试添加新记录时,vb.net会自动以递减值显示主键,但是当我单击注册并检查我的ms访问文件时,它会显示我的主键的正确值。