View Single Post
  #12 (permalink)  
Old May 12th, 2004, 12:49 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

UPDATE: Inside the loop, you're dealing with DataRowViews. Since the SelectedItem expects an Object, you can just pass in the current DataRowView item like this:
Code:
For Each MyItem As DataRowView In ComboBox1.Items
  MessageBox.Show(MyItem.Item("Name").ToString())
  If MyItem.Item("Name").ToString() = "A Name" Then
    ComboBox1.SelectedItem = MyItem
    ' Item found and selected, Exit the loop
    Exit For
  End If
Next
Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Hymn Of The Big Wheel by Massive Attack (Track 9 from the album: Blue Lines) What's This?
The Following User Says Thank You to Imar For This Useful Post:
Ron Howerton (February 22nd, 2013)