Base Windows Form Class (newby)

Discussion in 'ASP .Net' started by Fred Nelson, Feb 10, 2004.

  1. Fred Nelson

    Fred Nelson Guest

    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
     
    Fred Nelson, Feb 10, 2004
    #1
    1. Advertising

  2. Fred Nelson

    Gary Vidal Guest

    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" <> wrote in message
    news:utSYRc$...
    > 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
    >
    >
     
    Gary Vidal, Feb 10, 2004
    #2
    1. Advertising

  3. Fred Nelson

    Fred Nelson Guest

    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" <> wrote in message
    news:...
    > 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
     
    Fred Nelson, Feb 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tomek
    Replies:
    2
    Views:
    681
    Andrey Tarasevich
    Dec 1, 2003
  2. Alf P. Steinbach
    Replies:
    6
    Views:
    549
    John Carson
    Sep 3, 2005
  3. Hicham Mouline
    Replies:
    1
    Views:
    595
    Victor Bazarov
    Apr 20, 2009
  4. Lionel Thiry
    Replies:
    19
    Views:
    365
    Randy Kramer
    Mar 15, 2005
  5. Karan Rajput
    Replies:
    2
    Views:
    145
    Abinoam Jr.
    Dec 22, 2010
Loading...

Share This Page