We are hitting a problem that we can't explain and wondered if anyone has
seen this before or can suggest how we can stop it happening :

Form 'A' inherits from System.Windows.Forms.Form
Form 'B' inherits from Form 'A'.
Form C inherits from Form B.

Form B (the one in the middle) has a TextBox component on it.

The constructor of Form 'C' attempts to assign a string value to the 'Text'
property of the TextBox. It does this after all form initialization has
taken place.

Occasionally (we haven't identified a definite pattern), when the code
assigning the 'Text' property of the TextBox executes, it falls over with an
exception 'Object variable not set to an instance of an object'.

The problem definitely lies with the assignment (i.e. does not lie with the
value being assigned). We've also tried Me.TextBox.Text = value and
MyBase.TextBox.Text = value but still the same. We've also tried assigning
values to different components (such as CheckBox.Checked = True) and the
same thing happens. The component can be read; i.e. code like
MsgBox(TextBox.Text) works fine.

We thought we had solved the problem when discovering that if the component'
s properties have anything assigned to them at design time, then this
run-time issue would occur fairly frequently (but seemingly randomly).
Ensuring nothing is assigned at design time (i.e. the 'Text' property or
'Checked' property is not assigned at design time) seemed to halt the issue
occurring. However, now it is occurring again and we can't fix it.

This does seem to be a form inheritance issue as I haven't seen it on any
forms that are just inherited from System.Windows.Forms.Form.


Thanks for any help,

Steve

RE: Error in Form Constructor by v-jetan

v-jetan
Fri Jan 28 02:38:56 CST 2005

Hi Steve,

Have you succeeded create out a sample project to reproduce this issue? Is
your problem resolved? Please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Re: Error in Form Constructor by Steve

Steve
Sun Jan 30 14:03:03 CST 2005

Jeffrey,

Some confusion our end. One of my guys will be looking at it tomorrow.

Will keep you informed.

Thanks

Steve

""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:O%23RdWTRBFHA.2660@cpmsftngxa10.phx.gbl...
> Hi Steve,
>
> Have you succeeded create out a sample project to reproduce this issue? Is
> your problem resolved? Please feel free to tell me, thanks.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



Re: Error in Form Constructor by v-jetan

v-jetan
Tue Feb 01 02:00:41 CST 2005

Ok, I will wait for your further feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.