'New' cannot be used on an interface > Dim dt As New DataTable("ID") <- works on some vb forms but not on other

Posted on 2006-03-30
Last Modified: 2008-02-01
i've got 2 vb forms and i cannot for the love of me figure out what the difference between them are.

Dim dt As New DataTable("ID")

works on my 1 form, but not on some of the other forms
it give the ERROR : 'New' cannot be used on an interface

i searched for word interface on the page, but didnt find it.
i can copy the exact code to another page and it will work there.

pls help.

Question by:jxharding
    1 Comment
    LVL 62

    Accepted Solution

    Hi jxharding;

    In the form that it does not work try it like this:

            Dim dt As New System.Data.DataTable("ID")

    It may be that you have imported other name spaces in the form that it does not work and you are getting name clash.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Flash ( has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now