473,698 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Index was out of range. Must be non-negative and less than the size of the collection

1 New Member
Hi,

I've a form and the form is working fine also. But my problem is
Whenever I closed the form. I'm getting two errors.

1.Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

2.Arithmetic overflow error converting varchar to data type numeric.
The statement has been terminated.


Events are :
Private Sub btnFilClose_Cli ck(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnFilClose.Cli ck, btnBrowClose.Cl ick

'This event is used to close the form

Try
Me.Cursor = Cursors.WaitCur sor
Me.Close() ' I'm getting the error on this line
Me.Cursor = Cursors.Default
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show (ex.Message)
Finally
Me.Cursor = Cursors.Default
Me.Close()
End Try
End Sub

Private Sub forms_FormClosi ng(ByVal sender As Object, ByVal e As System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing
'This event will be fired automatically whenever form will be closing

Try
Me.Cursor = Cursors.WaitCur sor
If MessageBox.Show ("Do you want to close this form", Me.Text, MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = Windows.Forms.D ialogResult.Yes Then

'If user press Yes then Form will be closed
Me.Cursor = Cursors.Default
e.Cancel = False
Else

'If User press No the Form will be not closed
e.Cancel = True
End If
Me.Cursor = Cursors.Default
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show (ex.Message)
End Try
End Sub

Please help me

Thanx in advance
Apr 12 '07 #1
1 3120
MMcCarthy
14,534 Recognized Expert Moderator MVP
This question is being moved to the Visual Basic forum.

ADMIN
Apr 12 '07 #2

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

Similar topics

1
4043
by: Andrew MacIntyre | last post by:
I'm seeing a bizarre situation where IndexErrors are being thrown with "tuple index out of range" error strings. The scenario is something like: l = for a, b in l: ...
1
4104
by: Arben Kryeziu | last post by:
I am getting following error: Persits.Upload.1 error '800a009' Index out of range. /rtdAddItemSave.asp line 27 >> Line 27 would be the one I marked ## <<
14
2239
by: Craig O'Shannessy | last post by:
Hi all, Just thought I'd mention that I really think this problem needs to be fixed. I I'm patching the 7.4RC1 JDBC drivers as we speak due to this optimiser bug, and it's the third time I've had to do this. I would think this bug causes quite a lot of people to evaluate postgres and decide it has awful primary key performance! I love postgres, and hate to think that this could be happening.
13
13403
by: Chameleon | last post by:
I am programming in C++ for 4 years, so I am not a newbie but I am not a very experienced programmer on standard C++ libary. My question is this: Can you tell me one case which an iterator is better than index? For me (until now) iterators are very strangely objects because they are useless for me. But since most of members of containers use iterators, I am stumped.
14
22560
by: micklee74 | last post by:
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the first occurence. I want to know the positions of both "1234" thanks
35
29217
by: erikwickstrom | last post by:
Hi all, I'm sorry about the newbie question, but I've been searching all afternoon and can't find the answer! I'm trying to get this bit of code to work without triggering the IndexError. import shutil, os, sys
85
4292
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the offending index are. Why does it force you to determine that information for yourself when it could save you a step and just tell you? This seems like a "no-brainer" to me. Am I missing something?
0
1663
by: muzu1232004 | last post by:
If I have a table t1 with a column a as follows A 1 1 1 1 1 1 1
2
3739
by: Georgy Panterov | last post by:
I am a relatively new python user. I am writing an economic simulation of acard-game. The simulation runs fine for a few iteration but then it gives an error of "list index out of range." The strange thing is that it will sometimes run for 10 iterations sometimesfor only a few and sometimes won't run at all (seemingly arbitrary). Here is some of the code: for _ in range(100): handA=deal_hand(DECK) #deals 2 'hole' cards from a DECK...
1
3211
by: Steffen Stellwag | last post by:
Truely is often better to scan a table in full passing by an index , but if you can force the optimizer to use an index via a hint for testing and comparing the results. But the index in the above example is not used , because the hint is malformed, if tables in a Select statment are named by aliases you have to specify the alias name in the hint statment , not the table name /*+ INDEX (ICWOIMP PK_ICWOIMP) */ change to /*+ INDEX (A...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8901
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
8871
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
7739
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
6528
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.