score:2

Accepted answer

i think it's better to get the filtered collection, instead for perform search after getting the collection. so i suggest you to use a where clause like the following to get filtered items only:

string searchstring ="a";

from row in repos.gettable<table_names>() 
where row.name.contains(searchstring)
select row.name;

instead for contains you can also try startswith if you want to get the collection of strings that starts with the given search text.

score:0

if you don't want to filter in the database, you can use linq to objects to further filter the collection in memory:

var filtered = collectionname.where(item => item.contains("a")).toarray();

score:0

you can use sqlmethods.like in linq query. check the code below

private void combobox1_textchanged(object sender, eventargs e)
    {
        combobox1.datasource = getitems(combobox1.text);
        combobox1.displaymember = "name";
        combobox1.valuemember = "id";
    }
    public static list<comboboxitem> getitems(string text)
    {
        dataclasses1datacontext context = new dataclasses1datacontext();
        try
        {
            list<comboboxitem> ilist = new list<comboboxitem>();
            var query =  from x in context.testcomboboxes where sqlmethods.like(x.name, '%' + text +'%') select x;
            foreach (var q in query)
            {
                comboboxitem item = new comboboxitem();
                item.id = q.id;
                item.name = q.name;
                ilist.add(item);
            }
            return ilist;
        }
        catch (exception ex)
        {
            return null;
        }
    }
    public class comboboxitem
    {
        public object id { get; set; }
        public string name { get; set; }
    }

Related Query

More Query from same tag