listbox search

H

Hrvoje Voda

I'm going through the listbox items with cursor.

I would like to put the selected listbox text into a textbox.

What method should I use?

Hrcko
 
A

Andrew Kirillov

Hello,

You can try to use SelectedIndexChanged event of ListBox.


listBox.SelectedIndexChanged += new
System.EventHandler(this.listBox_SelectedIndexChanged);

private void listBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
textBox.Text = listBox.SelectedItem.ToString( );
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Problem with WPF ListBox 5
checked listbox check all 3
ckecked listbox 4
class 3
check disabled 3
Property FormatString for ListBox 1
Access Cannot select items in listbox 1
checked list box 3

Top