473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

An error occurred creating the form... the error is: Index was out of range.

Hello All,

While trying to open a form I get the following error:

An error occurred creating the form. See Exception.InnerException for details. The error is: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Previously the form loaded flawlesly. I made several small changes to subs contained in the form, and after that the problem appeared. These changes included some changes in the constructor.

I've tried to track down the problem simply by adding message boxes near potential problem areas, and it seems that the exception is thrown before the constructor is even run. The error message baffles me, since I'm not knowingly using any parameters, and the routine opening the form doesn't refer to any arrays (or any other variables).

Here is the part of the source code that the error message refers to:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SugNewTagsBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SugNewTagsBtn.Click
  2.         SugNewTagsForm.Show()
  3.     End Sub
  4.  
I would really appreciate any advice you might have, since a cursory googling didn't yield any similar cases (which is weird, usually someone has already met and defeated the hurdles I'm faced with... I'm not that advanced a programmer)
Sep 11 '10 #1
1 6335
Okay, I found the problem. I had placed a function call in the initialising sub that handles MyBase.Load for the form, and this function had an internal reference to a table which reads it's values from a textbox placed on the form. As this textbox has default content (set in MS Visual Basic Express 2010 editor), I made the mistake of presuming it has content when MyBase.Load takes place. Since it has no content, the array will have no entries and thus referring to the arrays' index 0 causes the error.

What really confused me was that the error message referred to another form entirely (the form which opens the erroneous form), and that the initialising sub never ran.

I hope this monologue proves helpful to some other amateur fidling around with VB. :)
Sep 12 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: ES Kim | last post by:
"A Book on C" explains a technique to use an arbitrary array index range. int* p = malloc(sizeof(int) * 10) - 1; This way, the allocated array can be accessed with index range 1 ~ 10, not 0 ~...
2
by: Luke | last post by:
Hi I have the following code which is an ASP questionnaire using an Access database. (I am using access as I have no choice!). Basically there is an html form which submits the form to the page...
0
by: vareck.walla | last post by:
I get this error everytime I run my project: System.InvalidOperationException was unhandled Message="An error occurred creating the form. See Exception.InnerException for details. The error is:...
5
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
2
by: mike_li | last post by:
On Window 2000 Professional Server DB2 UDB Level: DB2 code release "SQL07029" with level identifie "030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and "WR21337". In the...
2
by: SBlain | last post by:
I have an application which runs in our development enviroment which is Windows Server 2003 with the DOT.NET 1.1 framework. OUr production eviroment is W2K Server with SP4. We have other ASP.NET...
1
by: Anonymous | last post by:
My code has suddenly stopped compiling after some refactoring I carried out last week. I am using VC8 on W2K professional I get the following cryptic error: Error 77 fatal error C1001: An...
5
by: HKN | last post by:
Hi , i have created one AJAX enable sites ASP.NET for my client. it is working fine on my local machine . basically , i have got three servers ( DEV,TST,PRD) i have copied all the source code...
0
by: Gtu108 | last post by:
Hi, I am getting an error while uploading a published version of site. The error is like : Description: An error occurred during the parsing of a resource required to service this request....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.