谁能看到我看不到的简单错误?
我正在打开一个表格以允许将作业编号分配给没有任何发票的发票。
这是处理此问题的应用程序主窗体中的代码:
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
这是打开并显示相关列详细信息的表单
背后的代码很简单,包括:
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
它运行时发生的情况是您可以选择作业编号,但它们不会显示在 DataGridView 上并且不会更新基础上下文。
请问这个愚蠢的错误在哪里?