How to get Combobox.SelectedItem Return string value of what is selected instead of Service Reference Class?
Posted
by
Rohit Acharya
on Stack Overflow
See other posts from Stack Overflow
or by Rohit Acharya
Published on 2014-08-19T03:39:27Z
Indexed on
2014/08/19
4:20 UTC
Read the original article
Hit count: 289
I currently have the following code for a button. The message box shows SilverlightApplication2.ServiceReference2.Employee
instead of the text string selected by the user. The combobox items are being populated by a WCF service. As a result I am unable to pass it to the Async call. How do I get the string of what user selected?
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
object selectedItem = comobo1.SelectedItem.ToString();
MessageBox.Show(selectedItem.ToString());
var proxy = new Service1Client();
proxy.GetAllEmployeesCompleted += proxy_GetAllEmployeesCompleted;
proxy.GetAllEmployeesAsync(selectedItem.ToString());
}
© Stack Overflow or respective owner