+92 332 4229 857 99ProjectIdeas@Gmail.com

Searching In ComboBox Through LINQ (C#.net)




Searching In ComboBox Through LINQ (C#.net):
The following code shows you search string in combobox through LINQ.


Code

using System.Linq;

IEnumerable<Object> query =
        from Object item in comboBox1.Items
        where (item.ToString().ToUpper().Equals(textBox1.Text.ToUpper()))
        select item;
           
        foreach (Object obj in query) 
        {
             comboBox1.SelectedItem = obj;
             MessageBox.Show("Found");
        }


1 comments:

Ray said...

Good work! This was just what I was seeking.