473,394 Members | 1,722 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,394 software developers and data experts.

Base Windows Form Class (newby)

I'm working on a VB.NET application and I have heard that there are many
benefits to creating a base form class and using it. In my case I have
several user controls that I routinely put on each page and it would be
great to make changes to only one form and have them change all forms.

The problem is - I can't figure out how to create one and MSDN assumes that
you already know how!

Does anyone know where there is a tutorial on how to do this?

I would greatly appreciate it!

Thanks,

Fred
Nov 18 '05 #1
2 961
Home
You can only use single line of Inheritance although each class can
implement multiple interfaces
(Contract no implementation)
Public Class BaseForm : Inherits System.Windows.Forms.Form

'Your form base code in here

End Class

Public Class InheritedForm : Inherits MyNamespace.BaseForm

End Class

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I'm working on a VB.NET application and I have heard that there are many
benefits to creating a base form class and using it. In my case I have
several user controls that I routinely put on each page and it would be
great to make changes to only one form and have them change all forms.

The problem is - I can't figure out how to create one and MSDN assumes that you already know how!

Does anyone know where there is a tutorial on how to do this?

I would greatly appreciate it!

Thanks,

Fred

Nov 18 '05 #2
David:

I'm confused!?

I have several user controls that I put on my forms already.

A book that I'm reading says that you can create your own base form so that
you can inherit from it rather than placing the controls on each new form.
If you do this then you don't need to put your user controls on each form as
they are already there. Also I have some security code that I would like to
put in the base form so I don't run the chance of not including it on each
page.

Is there an alternative to putting all the user controls on each form?

Thanks again,

Fred


"David Coe, MCP" <dh***@aol.com> wrote in message
news:14**********************************@microsof t.com...
Fred -

What you are looking to do is make a UserControl (.ascx) file that you can drop on each page. This control acts like a traditional include file in
ASP, with full code behind support. When you make a change to the control
file, the changes will be displayed everywhere the control is placed.
- David Coe, MCP

Nov 18 '05 #3

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

Similar topics

2
by: Yasutaka Ito | last post by:
Hi folks! I have a BaseForm class that inherits System.Windows.Forms.Form. It has a property, whose value I need supplied by the class that inherits it. The BaseForm usees the value supplied...
3
by: Peter Cresswell | last post by:
Hi guys/gals, I'm using VS.net 2003 and having trouble with the following: I am trying to inherit a base class into a web form, but VS will then not allow me to add any ASP.NET controls using...
1
by: ezzatm | last post by:
I've a very simple question:- if I run any method in the Mybase class, what exactly it will run against? e.g. Let's say i have in my project a form (form1) when i add such lines of code:...
5
by: Antuane | last post by:
is it possible for me to create a base form class, & then some how configure VB.NET, so that when ever i create a new form, it will automatically be based on the above form class. i know i can...
2
by: Urs Eichmann | last post by:
Hi using VS 2005 Beta 2, I want to define a base class for any type of entity, e.g. customer, item, order etc. The entity could have a key of type String or Integer, so I define the base class as...
2
by: UJ | last post by:
I have a base window I want to use to base all of my windows on (this has some timer functionality I need.) So I created the window winWindowBase and put the code in it. When I change the parent...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
1
by: Martijn Mulder | last post by:
Documentation suggests that I should make a call to the base-class method for some methods. When I try to do so for the class below, I get wrong results. What is the correct way to make a call to...
3
by: =?Utf-8?B?RWR3aW4=?= | last post by:
Hello Everyone. Below is the code that is in question. --- BEGIN CODE WITHIN INHERITED FORM --- protected virtual void OnFormClosing(object sender, FormClosingEventArgs e) { switch...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.