Creating an instance error

Posted on 2007-10-04
Last Modified: 2010-04-15
We have a "dll" code that's written in a proprietory language. It's like VB4 something.
Anyway, I want to use methods of this COM dll.

I did this: (i'm new to C# but want to try it in C# before I go to VB.Net)
I right-clicked on References, found that dll and added it to the References. For example ABCD
In the code I have:
using System.Runtime.InteropServices;
namespace whatever
   public partial class _Default : System.Web.UI.Page {
      protected void Button1_Click(object sender, EventArgs e)
           ABCD._DlcD myTest2 = new ABCD._DlcD();
            myTest2.PScreen("A01", 07, 07, 009, 009, "Tim", "Somewhere", 009, "ENGLISH", "DMASTER", 1);

*** why do I get this error when I compile..what am I missing:
Cannot create an instance of the abstract class or interface 'ABCD._DlcD'      
Question by:Camillia
    LVL 29

    Expert Comment

    by:Gautham Janardhan
    as the error says ABCD._DlcD will be abstract class or interface u will have to instantiate it into a class derived from ABCD._DlcD ;
    LVL 7

    Author Comment

    not sure what u u have an example?
    LVL 29

    Accepted Solution

    consider these two classes
    public abstract class AbstractClass
                public virtual void FunctionToOveride();
          public class ConcreteClass : AbstractClass
                public override void FunctionToOveride()
                      Console.Write("Hi there");


    if u try

    AbstractClass NewObject = new AbstractClass() it wil throw the error -> Cannot create an instance of the abstract class or interface

    the correct way would be
    AbstractClass NewObject = new ConcreteClass ();

    LVL 7

    Author Comment

    thanks, let me try and post back

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    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

    16 Experts available now in Live!

    Get 1:1 Help Now