1
Answer

Find and show an item in listbox

Ask a question
Amin Bhr

Amin Bhr

7y
232
1
hi all
question is i want to user put name of the item in serch textbox and then click on search button and when that item finded show tell number of that name in an other textbox here is my code
  1. private void btAdd_Click(object sender, EventArgs e)  
  2.     {  
  3.         tbTell.Text = tbTell.Text.ToString();  
  4.   
  5.         tbName.Text += " | " + tbFamily.Text;  
  6.         listnames.Items.Add(tbName.Text+" | "+tbTell.Text);  
  7.         string number = tbTell.Text;  
  8.         tbName.Text = "";  
  9.         tbName.Focus();  
  10.     }  
  11.     private void btnSerch_Click(object sender, EventArgs e)  
  12.     {  
  13.   
  14.         listnames.FindString(tbSerch.Text);  
  15.   
  16.   
  17.     }  
 
but this code is not working for search
but working for add a name with last name and phone number in 1 item in the list

Answers (1)