即使我确保正在使用的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