Языки

PHP
Функции  Добавить  Пользователи  Регистрация  Вход   Ресурс  Таблица ASCII  Помощь

VB.Net


1 Everything You Wanted to Know About Forms Inheritance in VB.Net

2 Concept of Inheritance

3 Visual Inheritance

4 What’s New in This Article

5 What_s New in This Article, Cont_d

6 Conclusion

What’s New in This Article



(Page 4 of 6 )

If you simply inherit the form, you will not be able to change the properties of the Controls which you have placed in the base form. This example covers:

  1. How to inherit the form
  2. How make custom properties
  3. How to use the custom properties from the Child form
  4. How you change the properties of the controls from the parent form, which are not in the parent form (i.e. they are in the Child forms)
  5. How to override the functionality of the Parent form from the Child Form
  6. How to change the properties of the inherited controls at design time (i.e. how to reposition the controls, set different properties, etc.)

1) How to inherit the form

Open the child form and replace the ChildForm’s Inherits line to <name of the parent form> from <System.Windows.Forms.Form>

Base Form:
Public Class PMainForm
    Inherits System.Windows.Forms.Form

Child Forms:
Public Class ChildForm
    Inherits PmainForm

2) How to make custom properties

Open the Parent Form and create a property (having a scope as Protected Friend)

    _CurrentPosition Property
    Dim LPosition As Long
    Protected Property Position() As Long
        Get
            Return LPosition
        End Get
        Set(ByVal Value As Long)
            LPosition = Value
        End Set
    End Property

3) How to use the custom properties from the Child form

Open the child Form. Use Me.<propertyName> to change the property. For example, we are changing the property in the Load event of the child form.

Private Sub CForm3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Position = 99
End Sub


1 2 3 4 5 6
Bacterial Charity Work Thwarts Medical Treatments

Cover image of the September 2, 2010 issue of the journal Nature

Drug resistant bacteria are a problem in many environments, especially healthcare institutions. While the ways in which these cells become resistant are understood at the cellular level, until now, the bacteria's survival strategies at the population level remained unclear.

A new study by James Collins and colleagues at Boston University and the Wyss Institute for Biologically Inspired Engineering at Harvard University reveals that a surprisingly small percentage of bacteria actually ...

More at http://www.nsf.gov/news/news_summ.jsp?cntn_id=117596&WT.mc_id=USNSF_51&WT.mc_ev=click


This is an NSF News item.

English
version


Статьи
Articles


Книги
Library


Скачать
Downloads

 © Internet, books, teachers and Rudevich Alexander brains.