473,626 Members | 3,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
Hello All,

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

An error occurred creating the form. See Exception.Inner Exception 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 6367
Sven Willgren
2 New Member
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
3685
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 ~ 9. You cannot use p, of course, and the memory should be released with free(p + 1). It worked with gcc and MSVC, but I'm not sure if it makes sense to take the address before the initial element of an array. Does anyone have any definite answer?
2
497
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 below and the code below submits the data to the DB and redirects the user. The code works locally on http://localhost or http://127.0.0.1 but when I upload it to a site (I have tried a few and they all error) it says "An error occurred on the...
0
1218
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: Item has already been added. Key in dictionary: 'System.Runtime.CompilerServices.CompilerGeneratedAttribute' Key being added: 'System.Runtime.CompilerServices.CompilerGeneratedAttribute'" Source="Interbase® Project 2006" StackTrace:
5
24747
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 on a receive. We are using .NET v1.1.
15
5329
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 path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
2
5514
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 db2diag.log, ---------------------------------------------------- 2005-12-20-10.05.43.278000 Instance:MC Node:000
2
1322
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 applications and web services running on the same server wich are running perfectly fine, it is only this new one I am trying to place into production. When attempting to bring up a page on the application in production I get he following error: ...
1
9510
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 internal error has occurred in the compiler. c:\program files\microsoft visual studio 8\vc\include\xmemory 155
5
2837
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 to the DEV and TST . Now most wonder thing happening is i have got one form which i enter the data into the dataGrid and i click on the "Apply" button to updated those enterd data into the databasse . Above functionality is working fine on...
0
1215
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. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load the assembly 'App_Web_oon-2ckc'. Make sure that it is compiled before accessing the page. Source Error:
0
8268
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.