不断出错,“非静态方法需要目标

时间:2019-09-18 18:41:38

标签: vb.net

即使我确保正在使用的var是共享的并且不为null,我仍会收到Non-Static错误。

        Using context = New iTracContext
            Dim trainingRec As TrainingRecord = context.TrainingRecords.Include("TrainingReference").Include("Employee").SingleOrDefault(Function(r) r.ReferenceID = CurrentReference.id And r.Employee.eid = CurrentEmployee.eid And r.due_date.Year = TrainingManagerForm.YR)
            If Not trainingRec Is Nothing Then
                Dim msg As String = "This module "
                msg = msg + trainingRec.TrainingReference.name + " is currently assigned to this employee with a Due Date of " + trainingRec.due_date
                MsgBox(msg, vbOKOnly, "Module Not Added")
                x = x + 1
            End If
        End Using

0 个答案:

没有答案