"Key not found" Exception Assigning to DataSource Property of Grid

C

Charles Law

This is driving me mad. Can someone please put me out of my misery?

I have a DataSet which I wish to use as the data source for a grid control
(it is actually an Infragistics grid). When I assign to the DataSource
property like this

UltraGrid1.DataSource = MyDataSet

I get the following exception:

Key not found
Parameter name: key

The dataset has six columns, and it doesn't make any difference whether I
create the columns in advance in the grid or not. I have checked
meticulously that the grid has columns that exactly correspond to the
columns in the dataset; no more and no fewer.

Any ideas chaps?

TIA

Charles
 
C

Cor Ligthert [MVP]

Charles,

Exact specifying the Table maybe

You can as well try the DataMember for that.

Cor
 
C

Charles Law

Hi Cor

I'm not sure I follow you. The dataset contains only one table. I have also
tried using a datatable object as the data source, but I get the same
exception.

Charles
 
C

Charles Law

Problem solved. Mea culpa.

Charles


Charles Law said:
Hi Cor

I'm not sure I follow you. The dataset contains only one table. I have
also tried using a datatable object as the data source, but I get the same
exception.

Charles
 
C

Charles Law

Hi Maureen

It was a while ago now, but I seem to remember that it was a faux pas on my
part. I had code in a grid event, and when I bound the grid this code was
triggered. The code in the event then tried to access a column that did not
exist. So, it was not my creation of the grid, which is where I was looking,
but the code to manipulate the grid data.

HTH

Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top