Search code examples
c#vb.netdomaincontext

How to do this in VB.NET?


i having problem in converting this C# code into VB.net. The loadLecturer seem to be having problem after convert to VB.NET

VB code just afterInitializeComponent()

context.Load(context.GetLecturesQuery(), LoadLecturer, Nothing)

The C# code i wish to convert and debug

private void LoadLecturer(LoadOperation<tblLecturer> obj)
{
    foreach (var item in obj.Entities)
    {
        cbLID.Items.Add(item.lecturerID + " - " + item.lfirstName + " " + item.llastName);
    }
}

Solution

  • Given the comment, it sounds like it's not the method itself which is causing you grief, but how you call it - because in the original code you're using a method group conversion. I suspect it's as simple as:

    context.Load(context.GetLecturesQuery(), AddressOf LoadLecturer, Nothing)