Why cannot inherit from public class that can be instantiated?

B

blisspikle

Can any Public class be inherited from? I installed some software on
my pc and I can use it in my code, but I cannot seem to inherit from
it. It was an executable that installed on my pc, I do not understand
how that works, but I can use it. I put it in the references to use
it in my code.

If I look at the definition it just says..
Public Class CABEthernet
Member of: vHMIABE

I can do the following....

Public Class MyClass
Public myInstance as new vHMIABE.CABEthernet
End Class

Shouldn't I be able to do the following...

Public Class MyClass
Inherits vHMIABE.CABEthernet
End Class
 
A

Armin Zingler

blisspikle said:
Can any Public class be inherited from?

Yes, unless it's marked as NotInheritable or if it only has private
constructors (sub new).
I installed some software
on my pc and I can use it in my code, but I cannot seem to inherit
from it.

Why? Do you get an error message? Which one?
It was an executable that installed on my pc, I do not
understand how that works, but I can use it. I put it in the
references to use it in my code.

If I look at the definition it just says..
Public Class CABEthernet
Member of: vHMIABE

I can do the following....

Public Class MyClass
Public myInstance as new vHMIABE.CABEthernet
End Class

Shouldn't I be able to do the following...

Public Class MyClass
Inherits vHMIABE.CABEthernet
End Class


Armin
 
A

Armin Zingler

blisspikle said:
It does have Methods in it, which it wouldn't if it was a structure
right? I am almost sure that it is a class. When I "right click"
and "go to definition" in VS2005 it tells me this...

Public Class CABEthernet
Member of: vHMIABE

When I click on it there are no New() methods that come up as
visible. I can instantiate this class and use it all I want though,
it works fine. I just wish that I could add a couple of properties
to it and still use it.




Sorry, I currently have no clue why this is.


Armin
 
B

blisspikle

Is this a DOTNET class ? Another possibility would be that this is actually
a COM class.

In this case try :http://msdn2.microsoft.com/en-us/library/2044hysa.aspx

(basically try Inherits vHMIOABE.CABEthernetClass and see if it works (note
the appended "Class"))

"blisspikle" <[email protected]> a écrit dans le message de (e-mail address removed)...








- Show quoted text -

That worked great. I just did...

Public Class MyClass
Inherits vHMIABE.CABEthernetClass

The msdn article that you gave me is hard to read, I am glad you gave
me a clue. I believe the code that I downloaded was written in an
earlier version of vb, because an example project came with it and
vb.net had to convert it when I opened it.

Thank you,
 

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