【发布时间】:2017-05-18 11:38:02
【问题描述】:
我收到错误消息,“无法将类型 'System.Collections.IEnumberable' 隐式转换为 'string'。存在显式转换)”
我尝试过使用 Convert.ToString() 和 .ToString,但是当发生这种情况时,ComboBox 不会填充。 我可以直接使用 SQLConnection 填充,但我的主要目标是通过 WCF 服务实现。 我错过了什么?
C#:
{
public MainWindow()
{
InitializeComponent();
BindComboBox(cbxUsername);
}
public void BindComboBox(ComboBox Username)
{
ServiceReference1.Service1Client Client = new ServiceReference1.Service1Client();
ServiceReference1.getUser GetUsername = new ServiceReference1.getUser();
GetUsername.Username = cbxUsername.ItemsSource;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
}
}
【问题讨论】: