Need urgent help---Google like search in an windows application

Posted by Tanvi under C# on 8/5/2009 | Views : 3305 | Status : [Member] | Replies : 1
I am new to C# and want to create an application which has Google like search mechanism.
Whenever we try to type an letter of an word, corresponding keywords are displayed in a popup. For that I have taken a textbox and a list box. The listbox acts as the popup and I am making it visible only when the key press event of textbox is generated.
I have also created a list and have bind it to the listbox using the DataTable. Now when I am trying to search the corresponding keywords, I am searching it into the Datatable. I am not getting any error but I am not even getting the output.
Following is the code snippet....

public void CreateCollection()
{
dt = new DataTable("ListItems");
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Address", typeof(string));

DataRow dr;
dr = dt.NewRow();
dr["Name"] = "aaa";
dr["ID"] = 1;
dr["Address"] = "Mumbai";
dt.Rows.Add(dr);

DataRow dr1;
dr1 = dt.NewRow();
dr1["Name"] = "bbb";
dr1["ID"] = 1;
dr1["Address"] = "Mumbai";
dt.Rows.Add(dr1);

lbsearch.datasource=dt;
}

pubilc void SearchItem()
{
MessageBox.Show(dt.Rows.Count.ToString());
lbSearch.DisplayMember = "Name";
lbSearch.ValueMember = "Name";
string Item = dt.Select("Name=aaa").ToString();
MessageBox.Show(lbSearch.Items.Count.ToString());
MessageBox.Show(Item);
}




Responses

Posted by: Poster on: 8/5/2009 [Member] Starter

Up
0
Down
Please go through following link and you should get the solution.

http://www.dotnetspider.com/resources/30998-Creating-winforms-AutoComplete-TextBox-using-C.aspx

http://www.codeproject.com/KB/WPF/WPFAutoCompleteTextbox.aspx

Thanks

Tanvi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response