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);
}