Click here to Skip to main content
15,848,157 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have this little program:
VB
Private Sub ButtonDecharger_Click(ByVal sender As System.Object, ByVal e As
      System.Windows.RoutedEventArgs) Handles ButtonDecharger.Click


      SpyModemem.GetItem(BytesNumber, ComportNumber, cualmodem)

      TextBox1.Text = cualmodem
End Sub
When i do "click" in the "ButtonDecharger", i get the next problem:

"An unhandled exception of type 'System.IndexOutOfRangeException' occurred in JriSpCore.dll"

"Additional information: L'index se trouve en dehors des limites du tableau".


What kind of error is that one. I don't have any array.

Somebody can help me please?

Thanks
Posted
Updated 31-Jul-13 5:47am
v3
Comments
[no name] 31-Jul-13 10:41am    
"What kind of error is that one"... "L'index se trouve en dehors des limites du tableau", it's French...
It does not have to be your array.
Sergey Alexandrovich Kryukov 31-Jul-13 10:51am    
5! :-)
(OP needs to learn French, is that what you say? :-)
—SA
alonetmr 31-Jul-13 10:49am    
hi, sorry, is french. the traduction is:

Index was outside the bounds of the array
Sergey Alexandrovich Kryukov 31-Jul-13 10:52am    
Are you sure it's an array, nothing else. Likewise, it could be any collection with indexing. In all cases, the methods of investigation and fixing of the problems are very similar...
—SA
alonetmr 31-Jul-13 10:55am    
ok, so if is not an array,what could be?

Having some exception in the library without the source code can be a problem, but, if the library is good enough and this is not a library bug, the problem is usually easy to solve.

Do the following: catch all exception in the thread, on the stack frame on top of the problematic point (could be on the very top stack frame of the thread, which you ultimately have to do with most threads). When exception is caught, output (log, for example) the exception StackTrace:
http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx[^].

This is just a string. Reading the trace, you will see the stack of calls leading to the point where the exception is thrown. Very usual case is that you call something with bad parameters going outside of some valid index range. Chances to locate and fix the bug are usually high.

Good luck,
—SA
 
Share this answer
 
Comments
CPallini 31-Jul-13 11:23am    
My 5.
Sergey Alexandrovich Kryukov 31-Jul-13 11:45am    
Thank you, Carlo.
—SA
Beware that the index may start at 0 or -1 depening on the conventions of the programming language used for that Third Party Library. So check that the values of BytesNumber, ComportNumber (and perhaps also cualmodem) fall within the expected range (you may add/substract 1 from those numbers to test hypotheses).
 
Share this answer
 
Comments
alonetmr 31-Jul-13 11:01am    
Hi,
I just remove an item and got the following error:

"Argument not specified for parameter 'DeviceId' of 'Public Sub GetItem(Index As Integer, ByRef COMPortNumber As Integer, ByRef DeviceId As String)'.

So, the problem it doesn't came for the numbers of arguments. It must be three (3).
Bernhard Hiller 1-Aug-13 2:15am    
NO!!! That's not what I said. Do not reduce the number of arguments! Change the VALUEs of the arguments by adding or substracting 1.
alonetmr 1-Aug-13 3:40am    
HI, thank you for you answer but when you said : adding or substracting 1, what means that?
I can't understand your point.
Well, you have no array, but it looks the library you are using has one. You should check out the library documentation (or, if available, its source code).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 31-Jul-13 10:49am    
Good point :-) A 5.
Oops! See the comment to the question by ThePhantomUpvoter. What OP though would be an array might be not...
—SA
CPallini 31-Jul-13 11:07am    
Thank you, Sergey.
alonetmr 31-Jul-13 10:52am    
hi,
In fact i have an Library DLL. But how i can found the array in my Library?
Thanks for you answer
Sergey Alexandrovich Kryukov 31-Jul-13 11:14am    
Who told you it's an array?! OK, please see my answer. This is usually easy to do.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900