Results 1 to 3 of 3

Thread: Inheriting a Form within the same project

  1. #1

    Thread Starter
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Inheriting a Form within the same project

    Hi

    I'm trying "Visual Inheritance" in C# and facing an issue which might be related to my ignorance about namespaces and location of the source code within the folders so I'll try to explain my problem.

    I have a windows application called TestApp who's source is located under:

    d:\rajooDotNet\C#\TestApp

    I create a base form with three buttons and this is saved as
    d:\rajooDotNet\C#\TestApp\baseform.vb

    The code in this form contains a line at the top as:
    namespace TestApp

    Now I want to create a new form, say formnew, and inherit the base form. I follow the instructions in the help, i.e. build the app first and then add the new Inherted form and using the inheritance browser. I end up with a source that contains a line like:

    public Class formnew : TestApp.baseform
    {
    // bla bla ....
    }

    When I want to display the inherited form in the designer I get an error message stating that the form cannot be displayed and hints things like, reference the project containing the base form or build the project if it the base form is in the same project.

    I tried and tried until I copied my project to the root folder of the drive d: i.e my source code is now in

    d:\TestApp

    I can then successfully view the inherited form in the designer.

    So my question is:

    How can I use visual inheritance without having my source code at the top level of the folder and also if I don't want to embed the top level folder, in my case d:\rajooDotNet\C#, in the namespace?

    For your info I had the same problem in VB.NET but this was resolved when I replaced the line:
    Code:
    Public Class formnew
          Inherits TestApp.baseform
    With

    Code:
    Public Class formnew
          Inherits baseform

    I'm using VS .NET 2002


    Thanks for your help.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  2. #2

    Thread Starter
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651

    Unhappy

    Found the solution to the problem at http://www.mail-archive.com/c_sharp@.../msg03029.html and I must admit I'm quite surprised.

    It seems the VS.NET doesn't like the # in my folder name :-(
    I changed d:\rajooDotNet\C#\TestApp to d:\rajooDotNet\chsarp\TestApp and my inherited form shows in the designer
    Last edited by Mr.No; Aug 15th, 2004 at 05:16 AM.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Weird !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width