Jump to content

Listview Arama Yapmak


lamont
 Share

Recommended Posts

arkadaşlar ListView Arama nasıl yapabilirz aşagıdaki şekilde arama yapmıyor

 private void button2_Click(object sender, EventArgs e)
        {
             for (int i = 0 ; i < listView1.Items . Count ; i++)
             {

               if (listView1.Items[i].SubItems[1].Text==textBox5.Text)
               {
                    listView1.SelectedItems.Count.ToString();
               }

              }

        }
    }
}

Edited by lamont
Link to comment
Share on other sites

Çözdüm Arama işini Kodları Paylaşıyorum 

private void button2_Click(object sender, EventArgs e)
        {

            string ara = textBox5.Text;
            if (!string.IsNullOrEmpty(ara))
            {
                foreach (ListViewItem arama in listView1.Items)
                {
                    string bul = arama.Text.ToString();
                    if (bul == ara)
                    {
                        arama.BackColor = Color.Yellow ;
                        arama.Checked = true;
                        ara = null;
                        break;
                    }
                    else
                    { 
                        continue;
                    }
                } 
            }

        }

Edited by lamont
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...