powered by simpleCommunicator - 2.0.58     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Наследование
2 сообщений из 2, страница 1 из 1
Наследование
    #38119650
Vova_1805
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Среда Visual Basic STUDIO’2010 Professional
Наследование. Как устранить ошибку.
Сделано согласно примеру MSDN'2008

Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
Public Class SubFormForEnter
' процедуры
End Class
Public Class Form2
    Inherits SubFormForEnter [color=red]' Базовый класс "SubFormForEnter", указанный 
    ' для класса "Form2", не может отличаться от базового класса 
    ' "System.Windows.Forms.Form" одного из его разделяемых типов.[/color]
End Class

СПАСИБО.

Ниже из msdn'2008^
To inherit from another class
• Add an Inherits statement with the name of a class you want to use as a base class as the first statement in your derived class. The Inherits statement must be the first non-comment statement after the class statement.
Example
The following example defines two classes. The first class is a base class that has two methods. The second class inherits both methods from the base class, overrides the second method, and defines a field named Field.
Visual Basic Copy Code

Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Class Class1
    Sub Method1()
        MsgBox("This is a method in the base class.")
    End Sub
    Overridable Sub Method2()
        MsgBox("This is another method in the base class.")
    End Sub
End Class

Class Class2
    Inherits Class1
    Public Field2 As Integer
    Overrides Sub Method2()
        MsgBox("This is a method in a derived class.")
    End Sub
End Class
...
Рейтинг: 0 / 0
Наследование
    #38119756
bazile
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Vova_1805,

в сообщении об ошибке все ясно сказано - класс формы должен наследоваться от класса System.Windows.Forms.Form или от его наследника. То есть тебе надо добавить Inherits System.Windows.Forms.Form к классу SubFormForEnter.
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Наследование
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]