This is my code. Sorry its messed up with loads of comments but by time it was getting frustrating. I'd appriciate any small help on this. The events i mentioned after i hit ENTER are all under the button "btenter"
CODE
Public Class Form1
Private Sub CFRecordsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CFRecordsBindingSource.EndEdit()
Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'KVCFDataSet.CFRecords' table. You can move, or remove it, as needed.
Me.CFRecordsTableAdapter.Fill(Me.KVCFDataSet.CFRecords)
NameTextBox.Focus()
NameTextBox.Text = ""
AgeTextBox.Text = ""
GenderTextBox.Text = ""
NationalityTextBox.Text = ""
UniversityCompanyTextBox.Text = ""
EmailIDTextBox.Text = ""
SpecializationTextBox.Text = ""
End Sub
'Private Sub btenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btenter.Click
' Me.Validate()
' Me.CFRecordsBindingSource.EndEdit()
' Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
' NameTextBox.Text = ""
' 'AgeTextBox.Text = ""
' GenderTextBox.Text = ""
' NationalityTextBox.Text = ""
' UniversityCompanyTextBox.Text = ""
' EmailIDTextBox.Text = ""
' SpecializationTextBox.Text = ""
' NameTextBox.Focus()
' 'Dim nrow As DataRow = KVCFDataSet.CFRecords.NewRow
' 'nrow("Name") = NameTextBox.Text
' 'nrow("Age") = CInt(AgeTextBox.Text)
' 'nrow("Gender") = GenderTextBox.Text
' 'nrow("Nationality") = NationalityTextBox.Text()
' 'nrow("UniversityCompany") = UniversityCompanyTextBox.Text
' 'nrow("EmailID") = EmailIDTextBox.Text
' 'nrow("Specialization") = SpecializationTextBox.Text
' 'KVCFDataSet.CFRecords.Rows.Add(nrow)
' 'Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
'End Sub
'Private Sub CFRecordsBindingSource_AddingNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles CFRecordsBindingSource.AddingNew
' Dim newrow As KVCFDataSet.CFRecordsRow
' newrow = KVCFDataSet.CFRecords.NewRow
' newrow.Name = NameTextBox.Text
' newrow.Age = AgeTextBox.Text
' newrow.Gender = GenderTextBox.Text
' newrow.Nationality = NationalityTextBox.Text
' newrow.UniversityCompany = UniversityCompanyTextBox.Text
' newrow.EmailID = EmailIDTextBox.Text
' newrow.Specialization = SpecializationTextBox.Text
' KVCFDataSet.CFRecords.AddCFRecordsRow(newrow)
' e.NewObject = newrow
' CFRecordsBindingSource.Position = CFRecordsBindingSource.Count - 1
'End Sub
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
End Sub
Private Sub SpecializationTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles SpecializationTextBox.KeyDown
If e.KeyCode = Keys.Enter Then
Me.BindingNavigatorAddNewItem_Click(sender, e)
'BindingNavigatorAddNewItem_Click(sender, e)
End If
End Sub
Private Sub SpecializationTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpecializationTextBox.TextChanged
End Sub
End Class
Private Sub CFRecordsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CFRecordsBindingSource.EndEdit()
Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'KVCFDataSet.CFRecords' table. You can move, or remove it, as needed.
Me.CFRecordsTableAdapter.Fill(Me.KVCFDataSet.CFRecords)
NameTextBox.Focus()
NameTextBox.Text = ""
AgeTextBox.Text = ""
GenderTextBox.Text = ""
NationalityTextBox.Text = ""
UniversityCompanyTextBox.Text = ""
EmailIDTextBox.Text = ""
SpecializationTextBox.Text = ""
End Sub
'Private Sub btenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btenter.Click
' Me.Validate()
' Me.CFRecordsBindingSource.EndEdit()
' Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
' NameTextBox.Text = ""
' 'AgeTextBox.Text = ""
' GenderTextBox.Text = ""
' NationalityTextBox.Text = ""
' UniversityCompanyTextBox.Text = ""
' EmailIDTextBox.Text = ""
' SpecializationTextBox.Text = ""
' NameTextBox.Focus()
' 'Dim nrow As DataRow = KVCFDataSet.CFRecords.NewRow
' 'nrow("Name") = NameTextBox.Text
' 'nrow("Age") = CInt(AgeTextBox.Text)
' 'nrow("Gender") = GenderTextBox.Text
' 'nrow("Nationality") = NationalityTextBox.Text()
' 'nrow("UniversityCompany") = UniversityCompanyTextBox.Text
' 'nrow("EmailID") = EmailIDTextBox.Text
' 'nrow("Specialization") = SpecializationTextBox.Text
' 'KVCFDataSet.CFRecords.Rows.Add(nrow)
' 'Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)
'End Sub
'Private Sub CFRecordsBindingSource_AddingNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles CFRecordsBindingSource.AddingNew
' Dim newrow As KVCFDataSet.CFRecordsRow
' newrow = KVCFDataSet.CFRecords.NewRow
' newrow.Name = NameTextBox.Text
' newrow.Age = AgeTextBox.Text
' newrow.Gender = GenderTextBox.Text
' newrow.Nationality = NationalityTextBox.Text
' newrow.UniversityCompany = UniversityCompanyTextBox.Text
' newrow.EmailID = EmailIDTextBox.Text
' newrow.Specialization = SpecializationTextBox.Text
' KVCFDataSet.CFRecords.AddCFRecordsRow(newrow)
' e.NewObject = newrow
' CFRecordsBindingSource.Position = CFRecordsBindingSource.Count - 1
'End Sub
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
End Sub
Private Sub SpecializationTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles SpecializationTextBox.KeyDown
If e.KeyCode = Keys.Enter Then
Me.BindingNavigatorAddNewItem_Click(sender, e)
'BindingNavigatorAddNewItem_Click(sender, e)
End If
End Sub
Private Sub SpecializationTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpecializationTextBox.TextChanged
End Sub
End Class
Regards
Dhanesh.


