| | |
Index was out of range. Must be non-negative and less than the size of the collection
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2007
Posts: 1
Reputation:
Solved Threads: 0
Index was out of range. Must be non-negative and less than the size of the collection
0
#1 Apr 12th, 2007
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
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

•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Re: Index was out of range. Must be non-negative and less than the size of the collection
0
#2 Apr 12th, 2007
![]() |
Similar Threads
- C++ Random Number Generator (C++)
- sending part of array (C)
- Program will not generate random numbers (C++)
- Index was out of range. Must be non-negative and less than the size of the collection (VB.NET)
- Byondspeed Enjoy! Free Cpanel Hosting: Subject (Web Hosting Deals)
- Byondspeed.com First Time 500Mb Space & 10GB Bnadwidth Free Hosting (Web Hosting Deals)
- allows a user to put a maximum and minimum price and see all properties in that price (C++)
- C++ Data Types (C++)
Other Threads in the VB.NET Forum
- Previous Thread: Windows Mobile & Datagrid
- Next Thread: database
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array assignment basic box button buttons center check code component connectionstring convert crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel fade file-dialog firewall folder ftp generatetags hardcopy image images input insert intel isnumericfuntioncall math monitor navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port problem problemwithinstallation project record reports" savedialog searchvb.net select serial shutdown string survey tcp temp temperature text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





