🔒 Closed how to code to search bar searching on listbox "showdialog"

Status
Not open for further replies.

m0stwanted143

Eternal Poster
Nahihirapan ako mag code sa searching sa listbox gumagana lang sya kapag nag add ka ng items sa mismong forms, pero kapag sa nag add ka ng items sa files or "Showdialog" di sya ma search bakit kaya?? Need kaya database ?
 
Sa Mismong Properties ng list lang yung gumagana pag nakaka search. kaya binura ko nalng .. need ko po ung pag nag lagay na po ako ng files tapos ma sesearch ko po pag ni run ko na po.. Thanks and Advance..
 
Post your search code
private void textBoxSeach_TextChanged(object sender, EventArgs e)
{


if (string.IsNullOrEmpty(textBoxSearch.Text) == false)
{

foreach (string str in listcollection)
{
if (str.StartsWith(textBoxSearch.Text))
{
listBox1.Items.Add(str);
}
}
}
else if (textBoxSearch.Text == "")
{
listBox1.Items.Clear();
foreach (string str in listcollection)
{
listBox1.Items.Add(str);
}
}
}
 
private void textBoxSeach_TextChanged(object sender, EventArgs e)
{


if (string.IsNullOrEmpty(textBoxSearch.Text) == false)
{

foreach (string str in listcollection)
{
if (str.StartsWith(textBoxSearch.Text))
{
listBox1.Items.Add(str);
}
}
}
else if (textBoxSearch.Text == "")
{
listBox1.Items.Clear();
foreach (string str in listcollection)
{
listBox1.Items.Add(str);
}
}
}
1603436059504.webp
 
Teka, you want, kapag nagsearch ka yung result lang ang matitira? and then clear yuing ibang items?
Tapos pag empty na yung search box, marerestore yung items?
 
Status
Not open for further replies.

About this Thread

  • 21
    Replies
  • 745
    Views
  • 3
    Participants
Last reply from:
zackmark29

Trending Topics

Online now

Members online
385
Guests online
4,061
Total visitors
4,446

Forum statistics

Threads
2,304,626
Posts
29,161,057
Members
1,196,910
Latest member
zein62
Back
Top