This is maybe a simple question but i need to know how to get string from selected listbox item, can anyone help me?
4 replies to this topic
#1
Posted 22 December 2011 - 02:17 AM
|
|
|
#2
Posted 22 December 2011 - 07:59 AM
[B][COLOR="#0000FF"]private void[/COLOR][/B] listBox1_SelectedIndexChanged(object sender, [COLOR="#0000FF"][B]System.EventArgs[/B][/COLOR] e)
{
MessageBox.[B][COLOR="#0000FF"]Show[/COLOR][/B](([B][COLOR="#0000FF"]string[/COLOR][/B])listBox1.[COLOR="#0000FF"][B]SelectedItem[/B][/COLOR]);
}
#3
Posted 22 December 2011 - 08:01 AM
Not in messagebox, I want to put it to some string, example: string a = listBox1....
#4
Posted 22 December 2011 - 08:03 AM
[COLOR="#0000FF"][B]public[/B][/COLOR] [COLOR="#0000FF"][B]string[/B][/COLOR] a = '';
[COLOR="#0000FF"][B]private[/B][/COLOR][COLOR="#0000FF"][B] void[/B][/COLOR] listBox1_SelectedIndexChanged(object sender, [B][COLOR="#0000FF"]System.EventArgs[/COLOR][/B] e)
{
a = ([COLOR="#0000FF"][B]string[/B][/COLOR])listBox1.[B][COLOR="#0000FF"]SelectedItem[/COLOR][/B];
}
#5
Posted 22 December 2011 - 08:09 AM
Gerg? Magyar said:
[COLOR="#0000FF"][B]public[/B][/COLOR] [COLOR="#0000FF"][B]string[/B][/COLOR] a = '';
[COLOR="#0000FF"][B]private[/B][/COLOR][COLOR="#0000FF"][B] void[/B][/COLOR] listBox1_SelectedIndexChanged(object sender, [B][COLOR="#0000FF"]System.EventArgs[/COLOR][/B] e)
{
a = ([COLOR="#0000FF"][B]string[/B][/COLOR])listBox1.[B][COLOR="#0000FF"]SelectedItem[/COLOR][/B];
}
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









