Visual Inheritance in Visual C#

Here’s how you can inherit visual elements from a base form in Visual C# using Visual Studio 2008.

First, create 2 forms, one for the base form and one for the child form.

On the solution explorer on the upper-right pane, right click on the child form and select ‘view code’

After that, you will see something like this:

image

Just change csharptesting to the actual name of your project

image

Then change MainForm to the actual name of the base form you want to use.

Then select ‘build’->’build solution’ from your main menu.

image

Notice, that your child form will now have the same visual elements as your Main form. But also note that only the Main Form is editable, you cannot edit its child forms.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s