🔒 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
  • 725
    Views
  • 3
    Participants
Last reply from:
zackmark29

Trending Topics

Online now

Members online
1,174
Guests online
1,413
Total visitors
2,587

Forum statistics

Threads
2,291,940
Posts
29,073,666
Members
1,210,111
Latest member
Satorman
Back
Top