We help IT Professionals succeed at work.

How to creata an instance of an Interface in VB.Net

JMO9966
JMO9966 asked
on
I'm migrating a project from C# to VB.Net and need to mimic this successful C# code in VB.net.

These two lines of code runs successfully in the C# project. ISchedulerFactory and IScheduler are both Interfaces:

            // First we must get a reference to a scheduler
            ISchedulerFactory sf = new StdSchedulerFactory();
            IScheduler sched = sf.GetScheduler();


Thanks
Comment
Watch Question

Éric MoreauSenior .Net Consultant
CERTIFIED EXPERT
Top Expert 2016

Commented:
this is VB 101!

            '// First we must get a reference to a scheduler
            dim sf as new StdSchedulerFactory()
            dim sched as IScheduler = sf.GetScheduler()
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Did you try?

Dim sf as ISchedularFactory = new StdSchedularFactory()
Dim sched As ISchedular = sf.GetSchedular()

Author

Commented:
That's the syntax I was using, thanks.

I discovered my issue was missing assemblies.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.