Forms inheretance

sosoisl

New member
Joined
Jan 17, 2007
Messages
1
Programming Experience
Beginner
hi,
am trying to build a VB windows application using inheritance ,
where i have a "main" form and a "child" form inheriting "main", when ever i write the word inherets main the design view of the child gives an error" Object not set to a reference of an object" and i cant view the form but when i run ,every thing debugs without errors and runs normally,

in my "main" i have :

Public Class Main
Inherits System.Windows.Forms.Form
...
Public WithEvents _Tbl As DataTable
Friend Retf As Boolean
Friend Newf As Boolean

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me._Tbl = New System.Data.DataTable 'I tried with and without this statement
CType(Me._Tbl, System.ComponentModel.ISupportInitialize).BeginInit()

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.Text = "Main"

CType(Me._Tbl, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
...
------------------------------
and in my child form i have :

Public Class Frm_AnnualWagesSalaries
Inherits Main
...

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
CType(Me._Tbl, System.ComponentModel.ISupportInitialize).EndInit()
' non of the Main's properties referenced in the child without instantiation
...

-----------------
am sure that the problem is with the inheritance because when i remove the inheritance clause and replace it with inherts Form the design view comes back to normal

am using Visual Studio 2003
I cant figure out the problem , please i appriciate any ideas,
Thanks
sosoisl
 
Back
Top