Home All Groups Group Topic Archive Search About

Typed Datasets with ComboBox

Author
12 Dec 2006 9:30 PM
gordigor
I am sure this is going to be obvious, but I can't see it. I have a
strong typed dataset called "Clients" with two columns: ClientName ,
ClientCode. I want to attach a ComboBox to this dataset. Here is the
code:

Dim TAListOfClients As New ClientsTableAdapters.ClientsTableAdapter

Dim ListOfClients As New Clients.ClientsDataTable
TAListOfClients.Fill(ListOfClients)

cboClientList.DataSource = ListOfClients

When I set the combobox to an untyped version it works:

cboClientList.DisplayMember = "ClientName"

When I set the combobox to the Typed version it displays
System.Data.DataRowView :

cboClientList.DisplayMember = ListOfClients(0).ClientName

I want to use the strongly typed version. Can anyone see what I am
doing wrong.

Thanks.

Author
12 Dec 2006 10:02 PM
RobinS
Didn't you post this exact question in another newsgroup
a day or so ago?  You can't bind the DisplayMember
to ListOfClients(0).ClientName. You might be able to
find it to ListOfClients.ClientName, but what's with the (0)?

Robin S.
--------------------------------------
Show quote
"gordigor" <dennyspamaccount@gmail.com> wrote in message
news:1165959024.663017.96590@n67g2000cwd.googlegroups.com...
>I am sure this is going to be obvious, but I can't see it. I have a
> strong typed dataset called "Clients" with two columns: ClientName ,
> ClientCode. I want to attach a ComboBox to this dataset. Here is the
> code:
>
> Dim TAListOfClients As New ClientsTableAdapters.ClientsTableAdapter
>
> Dim ListOfClients As New Clients.ClientsDataTable
> TAListOfClients.Fill(ListOfClients)
>
> cboClientList.DataSource = ListOfClients
>
> When I set the combobox to an untyped version it works:
>
> cboClientList.DisplayMember = "ClientName"
>
> When I set the combobox to the Typed version it displays
> System.Data.DataRowView :
>
> cboClientList.DisplayMember = ListOfClients(0).ClientName
>
> I want to use the strongly typed version. Can anyone see what I am
> doing wrong.
>
> Thanks.
>

AddThis Social Bookmark Button