Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Problem with Form Inheritance

Hello, I don't seem to be able to have a simple Form Inheritance in my project.
I have a separate project in my solution with a single .vb form, with the following code:

------------------------
Public Class FormsCommon

    Public ErrorPresent As Boolean
    Public AlreadyDone As Boolean
    Public TableCode As String

    Private Sub FormsCommon_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Public Interface CommonInterface
    Sub ControllaForm()
End Interface
-------------------------------

Then I try to create, in another project, a VB form that inherits from this one:

------------------------------
Public Class DemographicDataInformedConsent
    Inherits Humanitas.FormsCommon

    TableCode = "SDEM"
------------------------------

...but I simply get: "TableCode is not declared".

What am I doing wrong?
0
Emanuele_Ciriachi
Asked:
Emanuele_Ciriachi
  • 2
1 Solution
 
cottsakCommented:
you might need to add the 1st prject as a reference to the second. before you do that the parent class wont be visible.
0
 
doraiswamyCommented:
You would also need to add

imports humanitas

at the beginning of the code for the second project
0
 
Emanuele_CiriachiAuthor Commented:
Importing the base class project in the forms which extend it worked, thank you.
0
 
Emanuele_CiriachiAuthor Commented:
Nice and quick, managed to get me back on track and as such I give an "A". Would have liked an example to make the solution even more complete.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now