Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

Inheriting Object from parent form

$
0
0
Hi,

I have a main form and I also have an additional form that is loaded from the main form. I would like to reuse an object that is declared and initialized in the main form. How can I do this? I set the child form to inherit from the main form but when I try to use the object, I receive errors indicating that it has not been declared.

Here is an example of what I have:

Code:

public class Mainform

dim myObject as theObject = nothing
myObject = ctype(function(),theObject)

End class

public class Childform inherits Mainform

myObject.function()

End class


Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>