PC Review


Reply
Thread Tools Rate Thread

Could someone please explain

 
 
Beringer
Guest
Posts: n/a
 
      27th Jul 2004
I'm trying to set a datasource of a combobox to an ArrayList and want to set
the DisplayMember and ValueMember properties of the combobox to items in the
ArrayList.

I reviewed the example with US States found in VS but don't understand how
setting the DisplayMember and ValueMember properties works.
The member properties are to be set to string values of the names of the
properties to use in the DataSource. This doesn't make sense to me. What
are the properties of an ArrayList that can be used?

Thank you in advance,
Eric


 
Reply With Quote
 
 
 
 
Joyjit Mukherjee
Guest
Posts: n/a
 
      27th Jul 2004
Hi,
DisplayMember displays the the list of values for the list control, whereas
ValueMember is the value the control hold for account for that DisplayMember
when you select or change the display. e.g.

EmpId EmpName
101 Roger
102 John
103 Micheal

Here, you set the DisplayMember & ValueMember as EmpName and EmpId resp.
Now, when you select or change the EmpName, the corrosponding EmpId is
picked up for calculation. Is that clear ?

Regards
Joyjit
"Beringer" <(E-Mail Removed)> wrote in message
news:_1mNc.10221$8G6.6373@fed1read04...
> I'm trying to set a datasource of a combobox to an ArrayList and want to

set
> the DisplayMember and ValueMember properties of the combobox to items in

the
> ArrayList.
>
> I reviewed the example with US States found in VS but don't understand how
> setting the DisplayMember and ValueMember properties works.
> The member properties are to be set to string values of the names of the
> properties to use in the DataSource. This doesn't make sense to me. What
> are the properties of an ArrayList that can be used?
>
> Thank you in advance,
> Eric
>
>



 
Reply With Quote
 
Beringer
Guest
Posts: n/a
 
      28th Jul 2004
I understand the properties but don't understand where "EmpID" and "EmpName"
come from.
What are these names of? What kind of object do they belong too?
ArrayList, Class etc.

See I assume you set the DataSource to an object like an arraylist. Using
your example:

struct Employee
{
int EmpId;
string EmpName;
....other code for structure
}

ArrayList Employees;
(add empolyees to the list)

ListControl.DataSource = Employees;
ListControl.DisplayMember = "EmpName";
ListControl.DisplayValue = "EmpId";

blah, blah, blah....

The above will throw an exception, saying something like "Can't Set
DisplayMember".

Thanks again,
Eric


"Joyjit Mukherjee" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
> DisplayMember displays the the list of values for the list control,

whereas
> ValueMember is the value the control hold for account for that

DisplayMember
> when you select or change the display. e.g.
>
> EmpId EmpName
> 101 Roger
> 102 John
> 103 Micheal
>
> Here, you set the DisplayMember & ValueMember as EmpName and EmpId resp.
> Now, when you select or change the EmpName, the corrosponding EmpId is
> picked up for calculation. Is that clear ?
>
> Regards
> Joyjit
> "Beringer" <(E-Mail Removed)> wrote in message
> news:_1mNc.10221$8G6.6373@fed1read04...
> > I'm trying to set a datasource of a combobox to an ArrayList and want to

> set
> > the DisplayMember and ValueMember properties of the combobox to items in

> the
> > ArrayList.
> >
> > I reviewed the example with US States found in VS but don't understand

how
> > setting the DisplayMember and ValueMember properties works.
> > The member properties are to be set to string values of the names of the
> > properties to use in the DataSource. This doesn't make sense to me.

What
> > are the properties of an ArrayList that can be used?
> >
> > Thank you in advance,
> > Eric
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
please explain sunilpatel Microsoft Excel Programming 1 1st May 2009 08:58 PM
How do you explain Ant Windows XP New Users 19 27th Oct 2005 06:37 PM
Re: How do you explain Robert Aldwinckle Microsoft Word New Users 6 27th Oct 2005 06:51 AM
can someone explain.... =?Utf-8?B?VE9NIFAu?= Microsoft Windows 2000 RAS Routing 1 26th Jul 2004 02:32 PM
Can Someone explain this? bill lechner Microsoft Windows 2000 CMD Promt 2 30th Jun 2003 04:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 AM.