• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2246
  • Last Modified:

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

hi,
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 vb.net page and it will work there.

pls help.
thanks!

0
jxharding
Asked:
jxharding
1 Solution
 
Fernando SotoRetiredCommented:
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.

Fernando
0
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

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now