By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

combobox datasource

P: n/a
Why this does not work???

cb1 - combobox
DataProvider.DataProvider.DS_BringRacks() - DataSet
cb1.DataSource=DataProvider.DataProvider.DS_BringR acks().Tables[0];

cb1.DisplayMember = "id";

cb1.ValueMember = cb1.DisplayMember;

it diplays in combobox : "System.Data.DataRowView" instead of real values.
in debug view I can see that the dataset contants 1 column, named "id" with
3 rows, which have values.

So why this do not working???
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Does this work??

dvExample = new DataView
(DataProvider.DataProvider.DS_BringRacks().Tables
[0], "", "id ASC", DataViewRowState.OriginalRows);

cb1.DataSource = dvExample;
cb1.DisplayMember = "id";
cb1.ValueMember = cb1.DisplayMember;
Jerry Negrelli
Senior Software Engineer
Data Scientific Corporation
-----Original Message-----
Why this does not work???

cb1 - combobox
DataProvider.DataProvider.DS_BringRacks() - DataSet
cb1.DataSource=DataProvider.DataProvider.DS_Bring Racks ().Tables[0];
cb1.DisplayMember = "id";

cb1.ValueMember = cb1.DisplayMember;

it diplays in combobox : "System.Data.DataRowView" instead of real values.in debug view I can see that the dataset contants 1 column, named "id" with3 rows, which have values.

So why this do not working???
.

Nov 15 '05 #2

P: n/a
Nop, tried as well to create absolute new dataset - nothing...
I'm afraid it's because of event looker (I have event onindexchage on this
combobox for some reason it fired event BEFORE the application fully up on
dataload...)

What do you think?
"Jerry Negrelli" <je************@nospamdatascientific.com> wrote in message
news:01****************************@phx.gbl...
Does this work??

dvExample = new DataView
(DataProvider.DataProvider.DS_BringRacks().Tables
[0], "", "id ASC", DataViewRowState.OriginalRows);

cb1.DataSource = dvExample;
cb1.DisplayMember = "id";
cb1.ValueMember = cb1.DisplayMember;
Jerry Negrelli
Senior Software Engineer
Data Scientific Corporation
-----Original Message-----
Why this does not work???

cb1 - combobox
DataProvider.DataProvider.DS_BringRacks() - DataSet
cb1.DataSource=DataProvider.DataProvider.DS_Bring Racks

().Tables[0];

cb1.DisplayMember = "id";

cb1.ValueMember = cb1.DisplayMember;

it diplays in combobox : "System.Data.DataRowView"

instead of real values.
in debug view I can see that the dataset contants 1

column, named "id" with
3 rows, which have values.

So why this do not working???
.

Nov 15 '05 #3

P: n/a

Hi Tamir,

Based on my understanding, in your
DataProvider.DataProvider.DS_BringRacks(), it means that DataProvider
namespace contains a DataProvider class whoes DS_BringRacks() method
returns a dataset.

I think you should check if your dataset is generated correctly.
If it is generated well, I think your problem must be the DisplayMember. I
think the "id" field you assign to DisplayMember is not the correctly field
name in the dataset.

Sample listed below, this works well:(I use the default sql server database
to generate the dataset then bind it to combobox)

SqlDataAdapter adapter=new SqlDataAdapter("select * from
jobs","server=localhost;database=pubs;user=sa;pwd= ");
DataSet ds=new DataSet();
adapter.Fill (ds);
comboBox1.DataSource=ds.Tables[0];
comboBox1.DisplayMember="job_desc";
comboBox1.ValueMember =comboBox1.DisplayMember ;

While I change the "job_desc" to "job_des"(Lost one character), then the
combobox will display "System.Data.DataRowView".

If you have anything unclear, please feel free to let me know

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Tamir Khason" <ta**********@tcon-NOSPAM.co.il>
| References: <uk**************@TK2MSFTNGP09.phx.gbl>
<01****************************@phx.gbl>
| Subject: Re: combobox datasource
| Date: Mon, 10 Nov 2003 19:17:06 +0200
| Lines: 50
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <Oz**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 198.211.173.74
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:198111
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Nop, tried as well to create absolute new dataset - nothing...
| I'm afraid it's because of event looker (I have event onindexchage on this
| combobox for some reason it fired event BEFORE the application fully up on
| dataload...)
|
| What do you think?
|
|
| "Jerry Negrelli" <je************@nospamdatascientific.com> wrote in
message
| news:01****************************@phx.gbl...
| > Does this work??
| >
| > dvExample = new DataView
| > (DataProvider.DataProvider.DS_BringRacks().Tables
| > [0], "", "id ASC", DataViewRowState.OriginalRows);
| >
| > cb1.DataSource = dvExample;
| > cb1.DisplayMember = "id";
| > cb1.ValueMember = cb1.DisplayMember;
| >
| >
| > Jerry Negrelli
| > Senior Software Engineer
| > Data Scientific Corporation
| >
| > >-----Original Message-----
| > >Why this does not work???
| > >
| > >cb1 - combobox
| > >DataProvider.DataProvider.DS_BringRacks() - DataSet
| > >cb1.DataSource=DataProvider.DataProvider.DS_Bring Racks
| > ().Tables[0];
| > >
| > >cb1.DisplayMember = "id";
| > >
| > >cb1.ValueMember = cb1.DisplayMember;
| > >
| > >it diplays in combobox : "System.Data.DataRowView"
| > instead of real values.
| > >in debug view I can see that the dataset contants 1
| > column, named "id" with
| > >3 rows, which have values.
| > >
| > >So why this do not working???
| > >
| > >
| > >.
| > >
|
|
|

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.