Can anyone see the simple mistake that I can't?
I am opening a form to allow assigning Job Numbers to invoices that do not have any.
This is the code in the applications main form that handles this:
Dim unknownJobs = From pur In context.Purchases
Where pur.SentToMyob = False AndAlso
pur.Job.JobNumber = String.Empty
Select pur
If unknownJobs.Any Then
frmJobs2.JobsBindingSource.DataSource = (From j In context.Jobs1
Order By j.JobNumber
Select j).ToList
frmJobs2.PurchasesBindingSource.DataSource = unknownJobs
Progress.Hide()
If frmJobs2.ShowDialog = Windows.Forms.DialogResult.OK Then
context.SaveChanges()
End If
End If
This is the Form that gets opened with the relevant column details displayed
The Code behind is simple and consists of:
Public Class FormJobs2
''' <summary>
''' OK clicked
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub OKButton_Click(sender As System.Object, e As System.EventArgs) Handles OKButton.Click
Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()
End Sub
''' <summary>
''' Cancel clicked
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub SkipButton_Click(sender As System.Object, e As System.EventArgs) Handles SkipButton.Click
Me.DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
End Class
What happens when it runs is that you can select the job numbers BUT they do not display on the DataGridView and do not update the underlying context.
Where is the stupid mistake, please?