Hi.... I have a datepicker that contains an alternate key of an Access Table with a autokey primary key.
Private Sub DateTimePicker1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles DateTimePicker1.Validating
Dim d As Date = DateTimePicker1.Value
If d < Today Then
MsgBox("Gelieve een datum in de toekomst te willen aangeven.")
DateTimePicker1.Focus()
Exit Sub
End If
Dim n As Integer = Me.FeestdagenTableAdapter.Fill(Me.FeestdagenDataset.Feestdagen, d)
If n = 0 Then
Me.FeestdagenBindingSource.AddNew()
Me.DateTimePicker1.Value = d
Exit Sub
End If
End Sub
I have a "Save" Button
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
Me.FeestdagenBindingSource.EndEdit()
Me.FeestdagenTableAdapter.Update(FeestdagenDataset.Feestdagen)
Me.FeestdagenDataset.Clear()
Me.DateTimePicker1.Value = Today
Me.TextBox1.Text = ""
End Sub
Now this works fine in update mode, but in add (insert mode) the primary key is generated and the other field FD_Naam is updated alright, but FD_Datum is blank.
When I put a msgbox(me.datapicker1.value) it is set correctly when it gets in the save_click. How can I see/set what is "bound" int the Bindingsource? (I mean what would be the syntax to check what is / directly write in the form's dataset?).
Thanks for any light you could shed on this.