473,732 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple form designs with same code

Hi all, I am looking for a way to create two different forms, with
different look and feel. However, they would both have the same set of
controls, and reference the same code behind page. I would also like
to be able to switch between which form is displayed to the user
through the C# code. Is anything like this possible? I am using
VS2005. Thanks in advance for any ideas submitted!

May 22 '06 #1
2 1654
They call that Visual Inheritance and it supposed to
be supported in Visual Studio .NET 2005.

My experience with it has been less than impressive
if not an outright failure.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

<em*******@gmai l.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Hi all, I am looking for a way to create two different forms, with
different look and feel. However, they would both have the same set of
controls, and reference the same code behind page. I would also like
to be able to switch between which form is displayed to the user
through the C# code. Is anything like this possible? I am using
VS2005. Thanks in advance for any ideas submitted!

May 22 '06 #2
You can have the page clas in each case inherit from a common base class.
Just make sure to have that class inherit from the Page class. You'll still
have to write delegate functions to the parent class, but you gain the
ability to make small changes in one form that aren't in the other form
(trust me, it will happen).

In order to decide which form to display (assuming it depends on which user)
I would use an abstract clas factory:

public class AbstractForm : Page
{
// ... various virtual code
}

public class Form1 : AbstractForm
{
// ... implementation code
}

public class Form2 : AbstractForm
{
// ... implementation code
}

public class AbstractFactory
{
private static AbstractFactory _Factory;

private static Factory
{
get
{
if (_Factory == null)
_Factory = new AbstractFactory ();

return _Factory;
}
}

public virtual AbstractForm CreateForm();
}

public class Factory1
{
public overrides AbstractForm CreateForm()
{
return new Form1();
}
}

public class Factory2
{
public overrides AbstractForm CreateForm()
{
return new Form2();
}
}
--
Jeffrey Hornby
Hornby Consulting, Inc.

"em*******@gmai l.com" wrote:
Hi all, I am looking for a way to create two different forms, with
different look and feel. However, they would both have the same set of
controls, and reference the same code behind page. I would also like
to be able to switch between which form is displayed to the user
through the C# code. Is anything like this possible? I am using
VS2005. Thanks in advance for any ideas submitted!

May 23 '06 #3

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

Similar topics

19
2359
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a subset of records across all tables is often considered a separate logical system, but sometimes may be treaded ar part of the global system, and there is not simply a 1-m-m... tree among the records in a logical database. Here's an example. A...
32
14881
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
4
1227
by: Joshua Kendall | last post by:
This is the code that I currently Have for one password how do I specify multiple ones? There is no "or" statement! What do I do? Private Sub LoginBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBTN.Click If PassINP.Text = "bluecats" And UserINP.Text = "Joshua" Then Dim frmMainApp As New frmMainApp() : frmMainApp.Show() Else End End Sub
15
5082
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to form2....and there the data that i key in form1 will appear to form2 in textbox2 Thanks
6
1822
by: G.Ashok | last post by:
Hi, Does anybody know how Multiple polymorphism can be done in VB.NET or DOT doesn't support it? Is there any third party extensions available like for Java to do this? Regards, ....Ashok ------------------------------------------------------------------------ "It is beautiful for an engineer to shape and design the same way
47
3639
by: Mark | last post by:
why doesn't .NET support multiple inheritance? I think it's so silly! Cheers, Mark
60
4927
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the 'target' programming community herein) to get some community input and verify (or not) the following two statements. Few programmers (3 to7%) UNDERSTAND 'Strategic Functional Migration
9
18027
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form will almost always lead to the user opening a certain child window that's fairly resource intensive to load. Is it possible to load this form in a backgroundworker and then use the Show method and hide method as necessary? Anyone know of
4
2409
by: henry | last post by:
Folks: As a follow-up to my recent posts, I want to ask some more general questions about multiple instances of a CSS link in a page as seen by browsers due to server-side file inclusion. Let me set up my question by providing skeleton code for two files: Here's a skeleton of "index.php": <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9445
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9234
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.