Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

'System.IndexOutOfRangeException' in Master-Detail datargrid

Hai All,

I face the following strange error

An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll

Additional information: Index was outside the bounds of the array.

When I click the relation name in the datagrid. The datagrid has a relation and I am showing master and detail relation in the same datagrid.
When I cick the relation for the first two rows of master, it shows the correct details (child records). But, when I click the relation name at  third or any other row more than second, I get the above error. I have no clue what causes this problen. I tried to put try-catch block, no use.

Any help be appreciated.

Thanks in advance
0
karthikeyanTP
Asked:
karthikeyanTP
  • 3
1 Solution
 
karthikeyanTPAuthor Commented:
One more clue -- I used  GridColumnStyles for the datagrid. If I remove the  GridColumnStyles, and click the relation name it works fine. I am not sure why GridColumnStyles is causing problem. I want to use GridColumnStyles since I have combo boxes in the datagrid and user should have facility to update data using combo box in the datagrid.

0
 
Wim_BlCommented:
Hi,

it seems like this click-event somehow tries to read a value from an array which only has a size of 2 elements. Do you find any array like that in your app ? The "oufOfboundsException" clearly indicates this type of error.
0
 
karthikeyanTPAuthor Commented:
No, I don't have an array like that in my app. That error happens only when I click on the relation name.

 I checked the datatables of parent and child. They are returning correct values. I don't see any problem in the SQL query also, because without GridColumn styles the click-event on the relation does work fine.

0
 
karthikeyanTPAuthor Commented:
I found a workaround solution.  I used RustemSoft combo box. If I eliminate their combo box from my datagrid, everything works fine. I informed this problem to RustemSoft and couldn't get back anything from them. It's RustemSoft's combo box giving me error. I eliminated their combo and replaced with another one, which solves my problem.
0
 
PAQ_ManCommented:
Question Closed, 100 points refunded.
PAQ_Man
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now