473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.
Nov 16 '05 #1
1 3192
Found the solution to the problem at
http://www.mail-archive.com/c_sharp...m/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\chsarpTestApp and my
inherited form shows in the designer


"Hemraj Julha" <hj****@intnet.mu> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
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.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: thechaosengine | last post by:
Hi all, I wanted to put some common security functions into a class that inherits from the Page class and then use the new class as the basis for all my pages. Unfortunately, if I try and...
10
by: Tom | last post by:
I am looking for some ideas for how to design the layout of the form for data entry and to display the data for the following situation: There are many sales associates. A sales associate can work...
4
by: Ron Rohrssen | last post by:
I want to show a dialog and when the form (dialog) is closed, return to the calling form. The calling form should then be able to pass the child form to another object with the form as a...
0
by: Hemraj Julha | last post by:
Hi (Sorry if this appears twice but I posted this yersterday and I can't see it in the forum today) I'm trying "Visual Inheritance" in C# and facing an issue which might be related to my...
2
by: foo | last post by:
Hello, I have a form that I developed in a small simple project. The form runs fine by itself. When I try to create a new form that inherits from this form, the machine goes off in the weeds for...
3
by: YYZ | last post by:
I'm new to VB.net, but not new to OO in general, and I'm very strong in VB6. However, I don't know what I did in VB.net to cause this to happen. I've got 2 projects open at the same time, in the...
19
by: hamil | last post by:
I have a form with one button, Button1, and a Textbox, Textbox1 I have a class, class1 as follows. Public Class Class1 Public DeForm As Object Sub doit() DeForm.Textbox1.text = "It works"...
3
by: Roy Soltoff | last post by:
Two books, "Mastering Visual Basic.Net" and "Visual Basic.Net Developer's Handbook" describe inheriting from System.EventArgs using a class similar to: Public Class MyEventArgs Inherits...
1
by: =?Utf-8?B?a2Fu?= | last post by:
hi, Consider i have built a UserControl say 'ColorMixer' in proj 'Step1'(Windows Control Proj). Now when create another proj 'Step2' as Windows Control and try adding 'ColorMixer' as inherited...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.