I can't inherit from one class

E

Enric

Hi all of you,

Primary platform is xp with net 2.0

I've got this class:

Public Class Globals

Private Const _emailfrom As String = "(e-mail address removed)"
Private Const _smtpServer As String = "srvm.red1.es"

Public ReadOnly Property SmtpServer() As String
Get
Return _smtpServer
End Get
End Property
Public ReadOnly Property emailfrom() As String
Get
Return _emailfrom
End Get
End Property

End Class


And, later I want that GestionCredirenovePP class inherits from the first
one but I receive an error...
Public Class GestionCredirenovePP
Inherits Globals

I know that it's due to my own lack of knowledge myself so that I would
thank you any advice or further information.

tia
 
G

Göran Andersson

Enric said:
Hi all of you,

Primary platform is xp with net 2.0

I've got this class:

Public Class Globals

Private Const _emailfrom As String = "(e-mail address removed)"
Private Const _smtpServer As String = "srvm.red1.es"

Public ReadOnly Property SmtpServer() As String
Get
Return _smtpServer
End Get
End Property
Public ReadOnly Property emailfrom() As String
Get
Return _emailfrom
End Get
End Property

End Class


And, later I want that GestionCredirenovePP class inherits from the first
one but I receive an error...
Public Class GestionCredirenovePP
Inherits Globals

I know that it's due to my own lack of knowledge myself so that I would
thank you any advice or further information.

tia

I can't spot anything wrong in the code.

Which error do you get?
 
P

Phill W.

Enric said:
Primary platform is xp with net 2.0

I've got this class:

Public Class Globals
Private Const _emailfrom As String = "(e-mail address removed)"
Private Const _smtpServer As String = "srvm.red1.es"
Public ReadOnly Property SmtpServer() As String
Public ReadOnly Property emailfrom() As String
And, later I want that GestionCredirenovePP class inherits from the first
one but I receive an error...
Public Class GestionCredirenovePP
Inherits Globals

The code looks fine so - /what/ error?

My first guess would be that these two classes are in different
Projects. You need to reference one from the other for that to work.

Second guess would be that they're in different namespaces.

Namespace X.Y
Class Globals

Namespace A.B
Class GestionCredirenovePP
Inherits Globals

This won't compile until you qualify the base class, as in ...

Class GestionCredirenovePP
Inherits X.Y.Globals

.... or add an Import to "bring in" the X.Y namespace, as in ...

Imports X.Y

Class GestionCredirenovePP
Inherits Globals

HTH,
Phill W.
 
G

Göran Andersson

Patrice said:
Please, please, please, never post about an error without telling us WHICH
message you get...

Programmers are so picky... When I turn my car in for service, I just
say "Fix my car, it's not working". ;)
 
E

Enric

Thanks to all of you,

I get this message:

Specified base class "Globals" for GestionCredirenovePP class cannot be
diferent of base class System.windows.forms.form.

Pay attention that Globals already exists in Framework so that I title it as
"Globales".

In any case, I've taken the decision to put it in my second class:

Public Class GestionCredirenovePP

Public n As New Globales

And everything works fine.

Thanks again!!
Just work!!

Before I get a message which warn me: "
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top