1. On Saturday September 3RD, 2016 this community will be shutdown permanently.

    The time has come to close this community. I no longer have any interest in Visual Studio programming and my efforts to find someone to take over the community has failed.

    If anyone is interested in acquiring the database contact me and I will make it available for you.

Forms inheritance in VB 2010

Discussion in 'Visual Basic .Net' started by DN Admin, Dec 31, 2012.

  1. DN Admin

    DN Admin Administrator
    Staff Member

    United States
    Aug 7, 2010
    Likes Received:
    Joliet, IL U.S.A.
    <pre class="prettyprint lang-vb I have a form that has my base class that I would like a. create a child with two variables (one is string and the other is an array. I am getting an error stating that " 'Class Main.StimExam2' must declare a 'Sub New' because its base class 'Main.MyMainFormClass' doesn't have an accessible 'Sub New' I appreciate any hint, <span style="font-size:15.5pt; line-height:115%; font-family:'Courier New'; color:#2B91AF ‘Child form
    Public Class StimExam2
    Inherits MyMainFormClass
    Dim answerarray As String() = {"B", "C", "B", "D", "D", "B", "D", "A", "D", "B"}
    Dim StimExam2 As New MyMainFormClass ("P", answerarray)

    End Class
    '------ end of the child form---------------

    ‘ in main form class = MyMainFormClass, I added the following to initiate the two variables

    Private examFirstLetter As String ' first letter of the exam files
    Private QA As String() ' array of questions anawers

    Public Sub New(ByVal name As String, ByVal answerarray As String())
    myletter = name ' initiate the first letter
    QA = answerarray

    End Sub 'NEW

    Public Property myletter() As String
    Return examFirstLetter

    End Get
    Set(ByVal value As String)
    examFirstLetter = Name

    View the full article

Share This Page