Spyru Posted February 13, 2004 Posted February 13, 2004 Hey peepz, I have a sizable window, and I have a resize sub: Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize lblCreated.Left = Form1.ActiveForm.ClientSize.Width - 198 End Sub But when I start (F5) the app, it gives this error: Additional information: Object reference not set to an instance of an object. Does any of you can explain why this error is given? grtz, Spyru Quote
I Schobert Posted February 13, 2004 Posted February 13, 2004 Hey, I am not sure, but look in your initialize event of the form. I believe the form is initialized before the label. As such an instance of the label has not yet been created when the form is drawn on initialize and the resize event is fired. If that is wrong, how about this: Instead of using = Form1.ActiveForm.ClientSize.Width - 198 say = Me.ClientSize.Width - 198 Let me know if it works... Quote IS
Spyru Posted February 13, 2004 Author Posted February 13, 2004 WOOT Me.Clie... worked dude!! Thx! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.