Re: ComboBox ItemData?

From: Ginny Caughey [MVP] (ginny.caughey.online_at_wasteworks.com)
Date: 10/19/04


Date: Tue, 19 Oct 2004 10:30:31 -0400

Tim,

I use the ArrayList of objects approach described by Alex. The objects I use
like this all have a property called DataObject that looks like this:

public Customer DataObject
{ get{return tnis;}}

so I can just set the ValueMember of the combo box to DataObject and get
back the data object itself.

-- 
Ginny Caughey
.Net Compact Framework MVP
"Tim Johnson" <tjohnson@high-point.com> wrote in message 
news:eU55kFatEHA.1404@TK2MSFTNGP11.phx.gbl...
> I'm coming from MFC-land where a combobox had an ItemDataPtr property,
> whereby you could stash away a ptr to some arbitrary object.  Then when 
> the
> user selected an item, you could fetch the object back based on the 
> selected
> index.  Is there anything comparable in C#?  The only samples I've seen 
> show
> them managing their own separate arraylist corresponding to the items in 
> the
> combobox - yechh!
>
> -- 
> Tim Johnson
> High Point Software
> www.high-point.com
> (503) 312-8625
>
> 


Relevant Pages

  • Re: ComboBox ItemData?
    ... So I'm not using the SelectedValue as suggested, nor the DataObject idea, ... >> I'm coming from MFC-land where a combobox had an ItemDataPtr property, ... >> Tim Johnson ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ComboBox ItemData?
    ... > I Add a bunch of objects to my list and set the DataSource of the combobox ... > combobox will change to SelectedIndex -1. ... >> use like this all have a property called DataObject that looks like this: ...
    (microsoft.public.dotnet.framework.compactframework)