This is A C# Practice code:
Video For Result:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace database
- {
- public partial class ListboxSearch : Form
- {
- public ListboxSearch()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- listBox1.SelectedItems.Clear();
- for (int num = listBox1.Items.Count -1; num >= 0; num--)
- {
- if (listBox1.Items[num].ToString().ToLower().Contains(textBox3.Text.ToLower()))
- {
- listBox1.SetSelected(num,true);
- }
- }
- label3.Text = listBox1.SelectedItems.Count.ToString(); ;
- }
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- }
- private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- }
- }
Facebook Comment