I have a tab control in my form. I've put different datagridviews into separate tabpages. All my datagridviews are bound to a bindingsource. I'd like the tableadapter to update, like auto-saves, whenever there are edited/inserted new rows in the datagridview. I've tried DataGridView.IsCurrentRowDirty but it doesn't saves the rows.
Thanks in advanced for any reply.
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If addStatus = True Then
'Autosaves when user moves to another tab
addStatus = False
'MessageBox.Show("Position: " & Me.MAILBindingSource.Position & ", MailNo: " & Me.MAILNOTextBox.Text)
Select Case Me.TabControl1.SelectedIndex
'TODO: How to check if there are new/edited rows in datagridview?
If (Me.MAIL_INTERESTSDataGridView.IsCurrentRowDirty = True) Or (Me.MAILSOURCEDataGridView.IsCurrentRowDirty = True) Or (Me.MAILSTKDataGridView.IsCurrentRowDirty = True) Then 'addStatus = True Then
' Me.MAIL_INTERESTSTableAdapter.FillByMailNo(Me.MaillistDataSet.MAIL_INTERESTS, Me.MAILNOTextBox.Text)
Public Sub SaveAlsoToDB()
'Save the rest
'Mark end editing of all records
'Update all child records first, then parent records
I also have a binding navigator on that form. When I press the delete button, the record is not displayed to the user anymore. But when I refresh, it's still there.
This also happened eventhough I press Save. The supposedly deleted record is not deleted from database. Why is this so? Please help.
The TableAdapter generates insert/update/delete command. Insert and update is ok but not delete.
But anyway, I've set the BindingNavigatorDeleteItem to nothing and put a custom code in there. Thanks again for your reply. :)
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
If (MessageBox.Show("Are you sure you want to delete Mail No: " & Me.MAILNOTextBox.Text & "?", "Confirm Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.OK) Then