View Single Post
  #4 (permalink)  
Old May 11th, 2004, 02:40 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,948
Thanks: 79
Thanked 1,555 Times in 1,532 Posts
Default

Hi Ron,

There must be other ways to do this, but you could use FindStringExact to select the item, like this:

ComboBox1.SelectedIndex = ComboBox1.FindStringExact("YourString")

This will select the *first* item in the list that matches "YourString"

I think you get the error about DataRowView because that's the underlying datasource for the combobox.

I am not sure if this is the best way to preselect an item, but at least I got it working with this code......

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Vergeet Me by Doe Maar (Track 3 from the album: Doris Day en andere Stukken) What's This?
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Ron Howerton (February 22nd, 2013)