Forms inheritance in VB 2010

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<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 doesnt 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
Get
Return examFirstLetter

End Get
Set(ByVal value As String)
examFirstLetter = Name
[/code]
<br/>

View the full article
 
Back
Top