Sign in to follow this  

VB.NET error

This topic is 4608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made a simple notepad program in VB.NET and I have created the textbox control manually using the new textbox syntax. My intention is to make a simple notepad with tabs. In global declarations I created the array as:
Public MyTextBox(255) As TextBox

I created the control in my form's Load event, so the code is as below:
MyTextBox(0) = New TextBox
MyTextBox(0).Multiline = True
MyTextBox(0).Location = New Point(40, 40)
MyTextBox(0).Size = New Size(400, 300)
Controls.AddRange(New Control() {MyTextBox(0)})
frmMain_Resize(sender, e)

Then in the resize code I have:
MyTextBox(0).Left = 0
MyTextBox(0).Top = 0
MyTextBox(0).Width = Me.Width
MyTextBox(0).Height = Me.Height

I get the following error: InvalidOperationException was unhandled An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. How do I fix this? I don't even know what is going on! Thanks.

Share this post


Link to post
Share on other sites

This topic is 4608 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this