🔒 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 ?
 
Maybe query problem.
post your code. Let's see what's the problem

Pa help po ito yung code ko .

private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();

if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) ;
{

//this.textBox_path.Text = openFileDialog1.FileName(paths.GetFileName());
}
}
1603434185638.webp
 
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
  • 707
    Views
  • 3
    Participants
Last reply from:
zackmark29

Trending Topics

Online now

Members online
769
Guests online
1,212
Total visitors
1,981

Forum statistics

Threads
2,274,086
Posts
28,953,569
Members
1,235,055
Latest member
tayraleyt
Back
Top