Posted on 2016-08-23
Medium Priority
Last Modified: 2016-08-23
I'm new to using Interfaces.  I using  library that has an object defined as an interface.  How do I create/new an object of this type?
Question by:HLRosenberger
  • 2
  • 2
  • 2
LVL 45

Expert Comment

ID: 41766931
something like
dim obj as InterfaceX = new InterfaceX

Author Comment

ID: 41766956
if I do that, I get "'New' cannot be used on an interface".
LVL 45

Accepted Solution

AndyAinscow earned 1000 total points
ID: 41766987
oops, sorry.  The new should be used on a class that is based on the interface

dim obj as InterfaceX = new classX

with the following:
Public Interface InterfaceX
    Sub IFoo()
End Interface

Public Class classX
    Implements InterfaceX

    Public Sub IFoo() Implements InterfaceX.IFoo
    End Sub
End Class
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 64

Assisted Solution

by:Fernando Soto
Fernando Soto earned 1000 total points
ID: 41767016
Hi HLRosenberger;

An interface is a definition of what needs to be implemented in your code to fulfill the contract of that interface. Please see this Microsoft Documentation on Interfaces (Visual Basic) for more details.

Author Closing Comment

ID: 41767438
LVL 64

Expert Comment

by:Fernando Soto
ID: 41767447
Not a problem, glad to help.

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question