首页 > 解决方案 > 不断出现错误,“非静态方法需要一个目标

问题描述

即使我确保我正在使用的 var 是共享的并且不为空,我仍然会收到非静态错误。

        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

标签: vb.net

解决方案


推荐阅读