Saturday, March 31, 2012

Strande inheritance problem

I have two classes, one called frame1 and the other frame2.

In frame2 i import the frame1, and i also create an instance of it.

The problem is that in class frame1 i have an control declared:

Public WithEvents labelNameLogin As System.Web.UI.WebControls.Label

And when a try for eg, access to it a get an error:

If vObjFrameBoard.labelNameLogin.Text = "" Then -- error

'some code

Exit Sub

error:Object reference not set to an instance of an object

But if a try to access to an of its variables, declared as public a have no problem.
So where is the problem.

Thanks in advanceDoesnt anybody know how to solve this. I really need your help.
Thx
Thx for your help anyway.

Here is the soluction for the problem i was having.

Public WithEvents TextBox1 As System.Web.UI.WebControls.TextBox = New System.Web.UI.WebControls.TextBox

i tought the instance was done automatically, like when building an stand alone application.

0 comments:

Post a Comment