Home All Groups Group Topic Archive Search About

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

Author
4 Jun 2006 10:53 AM
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

Author
4 Jun 2006 11:44 AM
Cor Ligthert [MVP]
Charles,

Exact specifying the Table maybe

You can as well try the DataMember for that.

Cor

Show quoteHide quote
"Charles Law" <bl***@nowhere.com> schreef in bericht
news:O3whnU8hGHA.2208@TK2MSFTNGP05.phx.gbl...
> 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
>
>
Author
5 Jun 2006 10:35 AM
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


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%23XPJyv8hGHA.2456@TK2MSFTNGP04.phx.gbl...
> Charles,
>
> Exact specifying the Table maybe
>
> You can as well try the DataMember for that.
>
> Cor
>
> "Charles Law" <bl***@nowhere.com> schreef in bericht
> news:O3whnU8hGHA.2208@TK2MSFTNGP05.phx.gbl...
>> 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
>>
>>
>
>
Author
5 Jun 2006 2:01 PM
Charles Law
Problem solved. Mea culpa.

Charles


Show quoteHide quote
"Charles Law" <bl***@nowhere.com> wrote in message
news:uATqUvIiGHA.1612@TK2MSFTNGP04.phx.gbl...
> 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
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:%23XPJyv8hGHA.2456@TK2MSFTNGP04.phx.gbl...
>> Charles,
>>
>> Exact specifying the Table maybe
>>
>> You can as well try the DataMember for that.
>>
>> Cor
>>
>> "Charles Law" <bl***@nowhere.com> schreef in bericht
>> news:O3whnU8hGHA.2208@TK2MSFTNGP05.phx.gbl...
>>> 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
>>>
>>>
>>
>>
>
>
Author
8 Sep 2006 6:13 PM
Maureen Mate
How did you solve this problem?

Thanks, Maureen
Author
10 Oct 2006 1:35 PM
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


Show quoteHide quote
"Maureen Mate" <MaureenM@nospam.com> wrote in message
news:1567583d6a7a4d22b77bfd4f2618c39e@ureader.com...
> How did you solve this problem?
>
> Thanks, Maureen