Hello everyone,
Can someone please tell me why when i press the button to save the changes on several textboxe´s that i have from diferente tables, if i press the button it only save the changes from the first BindingContext, then i need to click on the other textbox and if the cursor is blinking there then i can press the save button again and then gets the changes again from that table and it works.
I would like to press the "save" button and save all the textbox´s at once.
The code that i have is this:
Thank you.
Can someone please tell me why when i press the button to save the changes on several textboxe´s that i have from diferente tables, if i press the button it only save the changes from the first BindingContext, then i need to click on the other textbox and if the cursor is blinking there then i can press the save button again and then gets the changes again from that table and it works.
I would like to press the "save" button and save all the textbox´s at once.
The code that i have is this:
Code:
Public Class frmPNTStockList
Private Sub frmAllPNTStockList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.HIGH_VISIBILITY_VEST' table. You can move, or remove it, as needed.
Me.HIGH_VISIBILITY_VESTTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.HIGH_VISIBILITY_VEST)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.HIGH_VISIBILITY_VEST' table. You can move, or remove it, as needed.
Me.HIGH_VISIBILITY_VESTTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.HIGH_VISIBILITY_VEST)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.PILOT_WING' table. You can move, or remove it, as needed.
Me.PILOT_WINGTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.PILOT_WING)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.TIE_MAN' table. You can move, or remove it, as needed.
Me.TIE_MANTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.TIE_MAN)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.STRIPES_FO' table. You can move, or remove it, as needed.
Me.STRIPES_FOTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.STRIPES_FO)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.STRIPES_COM' table. You can move, or remove it, as needed.
Me.STRIPES_COMTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.STRIPES_COM)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.BLUE_BELT_MEN' table. You can move, or remove it, as needed.
Me.BLUE_BELT_MENTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.BLUE_BELT_MEN)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.OVERCOAT_MAN' table. You can move, or remove it, as needed.
Me.OVERCOAT_MANTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.OVERCOAT_MAN)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.WHITE_SHIRT_LONG_SLEEVE' table. You can move, or remove it, as needed.
Me.WHITE_SHIRT_LONG_SLEEVETableAdapter.Fill(Me.Uniforms_SoftwareDataSet.WHITE_SHIRT_LONG_SLEEVE)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.WHITE_SHIRT_SHORT_SLEEVE' table. You can move, or remove it, as needed.
Me.WHITE_SHIRT_SHORT_SLEEVETableAdapter.Fill(Me.Uniforms_SoftwareDataSet.WHITE_SHIRT_SHORT_SLEEVE)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.TROUSERS_DARK_BLUE_MAN' table. You can move, or remove it, as needed.
Me.TROUSERS_DARK_BLUE_MANTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.TROUSERS_DARK_BLUE_MAN)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.BLAZER_DARK_BLUE_FO' table. You can move, or remove it, as needed.
Me.BLAZER_DARK_BLUE_FOTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.BLAZER_DARK_BLUE_FO)
'TODO: This line of code loads data into the 'Uniforms_SoftwareDataSet.BLAZER_DARK_BLUE_COM' table. You can move, or remove it, as needed.
Me.BLAZER_DARK_BLUE_COMTableAdapter.Fill(Me.Uniforms_SoftwareDataSet.BLAZER_DARK_BLUE_COM)
End Sub
Private Sub btnPNTSave_Click(sender As Object, e As EventArgs) Handles btnPNTStockListSave.Click
Save_Records()
End Sub
Private Sub Save_Records()
With Me.BindingContext(Me.Uniforms_SoftwareDataSet, "BLAZER_DARK_BLUE_COM")
.EndCurrentEdit()
If Uniforms_SoftwareDataSet.HasChanges Then
Try
If MsgBox("Record has changer!" & vbCrLf & "Save changes?", MsgBoxStyle.Question + MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2) = MsgBoxResult.Yes Then
Me.BLAZER_DARK_BLUE_COMTableAdapter.Update(Uniforms_SoftwareDataSet.GetChanges())
Uniforms_SoftwareDataSet.AcceptChanges()
Else
Uniforms_SoftwareDataSet.RejectChanges()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End With
With Me.BindingContext(Me.Uniforms_SoftwareDataSet, "BLAZER_DARK_BLUE_FO")
.EndCurrentEdit()
If Uniforms_SoftwareDataSet.HasChanges Then
Try
If MsgBox("Record has changer!" & vbCrLf & "Save changes?", MsgBoxStyle.Question + MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2) = MsgBoxResult.Yes Then
Me.BLAZER_DARK_BLUE_FOTableAdapter.Update(Uniforms_SoftwareDataSet.GetChanges())
Uniforms_SoftwareDataSet.AcceptChanges()
Else
Uniforms_SoftwareDataSet.RejectChanges()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End With
With Me.BindingContext(Me.Uniforms_SoftwareDataSet, "TROUSERS_DARK_BLUE_MAN")
.EndCurrentEdit()
If Uniforms_SoftwareDataSet.HasChanges Then
Try
If MsgBox("Record has changer!" & vbCrLf & "Save changes?", MsgBoxStyle.Question + MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2) = MsgBoxResult.Yes Then
Me.TROUSERS_DARK_BLUE_MANTableAdapter.Update(Uniforms_SoftwareDataSet.GetChanges())
Uniforms_SoftwareDataSet.AcceptChanges()
Else
Uniforms_SoftwareDataSet.RejectChanges()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End With
With Me.BindingContext(Me.Uniforms_SoftwareDataSet, "WHITE_SHIRT_SHORT_SLEEVE")
.EndCurrentEdit()
If Uniforms_SoftwareDataSet.HasChanges Then
Try
If MsgBox("Record has changer!" & vbCrLf & "Save changes?", MsgBoxStyle.Question + MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2) = MsgBoxResult.Yes Then
Me.WHITE_SHIRT_SHORT_SLEEVETableAdapter.Update(Uniforms_SoftwareDataSet.GetChanges())
Uniforms_SoftwareDataSet.AcceptChanges()
Else
Uniforms_SoftwareDataSet.RejectChanges()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End With
End Sub
End Class