473,327 Members | 1,976 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,327 software developers and data experts.

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

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_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilClose.Click, btnBrowClose.Click

'This event is used to close the form

Try
Me.Cursor = Cursors.WaitCursor
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_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'This event will be fired automatically whenever form will be closing

Try
Me.Cursor = Cursors.WaitCursor
If MessageBox.Show("Do you want to close this form", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.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 3108
MMcCarthy
14,534 Expert Mod 8TB
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
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
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
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...
13
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...
14
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...
35
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. ...
85
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...
0
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
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.