R
Ron L
I have created a form for my application. Once the form was working, I
copied that form to a new form that would contain all the common elements of
all forms in my application and made the existing form inherit from the
common one. Now when I try to run my application I get the following error
when I open the form:
An exception occurred while trying to create an instance of
WebWinFormTry1.frmNITSSForm. The exception was "Constructor on type
MyAppTest.frmParentForm not found.".
The relevant code for the 2 classes is included below. Can anyone tell me
what I am doing wrong here. As far as I can tell, I have the constructor
for both defined.
TIA
Ron L
frmParentForm.vb:
Option Strict On
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data.OleDb
Public Class frmParentForm
Inherits System.Windows.Forms.Form
Protected frmMain As myAppMain
Protected textIsDirty As Boolean
#Region " Windows Form Designer generated code "
'Public Sub New() ' Default constructor not implemented. Need to pass
the parent form in to work.
' MyBase.New()
' 'This call is required by the Windows Form Designer.
' InitializeComponent()
' 'Add any initialization after the InitializeComponent() call
'End Sub
Public Sub New(ByRef frmMainNew As myAppMain)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
frmMain = frmMainNew
Call BindAndLoadControls()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
.... code removed for brevity
#End Region
.... other common functions here
End Class
frmChildForm.vb:
Option Strict On
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data.OleDb
Public Class frmUserAdmin
Inherits MyAppTest.frmParentForm
Private dsUserList As New DataSet
Private dsUserData As New DataSet
Private dsPermissions As New DataSet
Private permsList As DataTable
#Region " Windows Form Designer generated code "
'Public Sub New() 'Default constructor not implemented. Need to pass in
main form to work.
' MyBase.New()
' 'This call is required by the Windows Form Designer.
' InitializeComponent()
' 'Add any initialization after the InitializeComponent() call
'End Sub
Public Sub New(ByRef frmMainNew As NITSSMain)
MyBase.New(frmMainNew)
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
frmMain = frmMainNew
Call BindAndLoadControls()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
.... Code removed for brevity
#End Region
.... code removed for brevity
End Class
copied that form to a new form that would contain all the common elements of
all forms in my application and made the existing form inherit from the
common one. Now when I try to run my application I get the following error
when I open the form:
An exception occurred while trying to create an instance of
WebWinFormTry1.frmNITSSForm. The exception was "Constructor on type
MyAppTest.frmParentForm not found.".
The relevant code for the 2 classes is included below. Can anyone tell me
what I am doing wrong here. As far as I can tell, I have the constructor
for both defined.
TIA
Ron L
frmParentForm.vb:
Option Strict On
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data.OleDb
Public Class frmParentForm
Inherits System.Windows.Forms.Form
Protected frmMain As myAppMain
Protected textIsDirty As Boolean
#Region " Windows Form Designer generated code "
'Public Sub New() ' Default constructor not implemented. Need to pass
the parent form in to work.
' MyBase.New()
' 'This call is required by the Windows Form Designer.
' InitializeComponent()
' 'Add any initialization after the InitializeComponent() call
'End Sub
Public Sub New(ByRef frmMainNew As myAppMain)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
frmMain = frmMainNew
Call BindAndLoadControls()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
.... code removed for brevity
#End Region
.... other common functions here
End Class
frmChildForm.vb:
Option Strict On
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data.OleDb
Public Class frmUserAdmin
Inherits MyAppTest.frmParentForm
Private dsUserList As New DataSet
Private dsUserData As New DataSet
Private dsPermissions As New DataSet
Private permsList As DataTable
#Region " Windows Form Designer generated code "
'Public Sub New() 'Default constructor not implemented. Need to pass in
main form to work.
' MyBase.New()
' 'This call is required by the Windows Form Designer.
' InitializeComponent()
' 'Add any initialization after the InitializeComponent() call
'End Sub
Public Sub New(ByRef frmMainNew As NITSSMain)
MyBase.New(frmMainNew)
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
frmMain = frmMainNew
Call BindAndLoadControls()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
.... Code removed for brevity
#End Region
.... code removed for brevity
End Class