I'm working on a search box to implement in my project, I know that there is no such thing as a search box within the toolbox in VS.
But I came across a question in Microsoft forum, and one of their moderator provided a class (code) that can perform the same functionality as a window search box. This uses a text box with cue controls. But I'm having some problems implementing this, for instance I want to do a search on a listbox that contains a collection of string, what type of code can I implement that would allow me to narrow down the results display on the list box while I'm typing?
Below is a snippet of my code. Leave a comment if any clarification is needed.
private void cueTextBox1_TextChanged(object sender, EventArgs e)
{
if (cueTextBox1.Text == listBox1.Text)
{
listBox1.Text = cueTextBox1.Text;
}
else if(cueTextBox1.Text != listBox1.Text)
{
listBox1.Text = cueTextBox1.Text;
}
else
{
listBox1.Items.Clear();
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
cueTextBox1.Text = listBox1.Text;
}