|
-
Jul 14th, 2004, 03:25 AM
#1
Thread Starter
New Member
error "Index was outside the bounds of the array"
I have a datatgrid with datasource of type Dataset (connected by SetDataBinding(ds, table_name).
Sometimes when I click on a row (uaually after resize a column or scroll the grid), I get this error message: "Index was outside the bounds of the array",
and the debugger points of the declaration of the form that starts the project.
Why is it happens and how to avoid this?
-
Jul 14th, 2004, 05:01 AM
#2
Retired VBF Adm1nistrator
Are you running in Debug mode or Release mode?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 14th, 2004, 05:43 AM
#3
Thread Starter
New Member
on debug mode
and by the way: I'm not deleteing any row from the dataset.
-
Jul 14th, 2004, 07:07 AM
#4
Hyperactive Member
Because you speak about debugger, I think you are in debug mode. Anyway debugger is often very stupid. Not always it indicates the row where error is fired. You have to look at what in the italian version you could find clicking on 'Dettagli' (I suppose Details in english version) if the button is available, if so, you can assume the last rownumber you can read (the one at the top) is the real row number where error occurs. This is only my experience, but until now it has always revealed true!
Good job!
Live long and prosper (Mr. Spock)
-
Jul 14th, 2004, 11:57 PM
#5
Thread Starter
New Member
There is no 'Details' button in this case
I know what you mean, because I saw this button in many error messages before, but in this case the error message does not contain this button.
Doesn't anyone knows this datagrid problem?
-
Jul 15th, 2004, 12:09 AM
#6
Thread Starter
New Member
I found the code that cause the problem
But I still don't understand why!
it's:
Dim hi As System.Windows.Forms.DataGrid.HitTestInfo
hi = datagrid1.HitTest(e.X, e.Y)
datagrid1.CurrentRowIndex = hi.Row
I get the error after resizing a grid column, and then click any grid cell.
-
Jul 15th, 2004, 03:30 AM
#7
Hyperactive Member
In fact...this is why I wrote 'if the button is available'
I saw, also that in the most of case (or always...I'm not sure ), an error occurred in a modal form, put the debbugger at ...showdialog.. line of code, not within the form. Very stupid!
Again... when you are stepping through the code ( F8 ), event routine, like FormClosing or Button.PerformClick, are executed in one shot and you can't follow their code if you don't put a breakpoint in their code. I don't know if there is some setting to change this behaviour
Anyway, I'm afraid but I have never used a datagrid, so I can't analyze your code
Good job and let's hope someone more experienced could help you, dear friend.
Live long and prosper (Mr. Spock)
-
Jul 15th, 2004, 04:07 AM
#8
Thread Starter
New Member
thanks for your effort
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|