Substitute for ComboBox FindString in compact framework?

T

tthompson2007

I have a combobox bound to a dataset containing States and their
corresponding ID's. How would I set the combobox selection to the textvalue
retrieved from the database?

In Windows forms I would do something like this, however my understanding is
that FindString is not available in the compact framework:

cboState.SelectedIndex = cboState.FindString(value)

I have read that an alternative is to iterate through the items collection,
however I can't seem to get this to work. Any sample code to accomplish this
would be much appreciated.
 
P

Peter Foot

It is possible to recreate this method with a little bit of native interop
since the underlying control supports the windows message to do the find. I
posted the details here:-
http://inthehand.com/blogs/peterfoot/archive/2008/07/10/implement-findstring-for-a-combobox.aspx

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - Software Solutions for a Mobile World
In The Hand Ltd - .NET Components for Mobility
 
T

Tobe Thompson

Thanks for your help Peter. By the way...I've gotten a lot of use out of
your book. Mobile Development Handbook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top