'System.IndexOutOfRangeException' in Master-Detail datargrid

Posted on 2005-03-14
Medium Priority
Last Modified: 2011-09-20
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
Question by:karthikeyanTP
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Author Comment

ID: 13536454
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.


Expert Comment

ID: 13537267

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.

Author Comment

ID: 13537713
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.


Author Comment

ID: 13622528
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.

Accepted Solution

PAQ_Man earned 0 total points
ID: 13648278
Question Closed, 100 points refunded.
Community Support Moderator

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question