获得ComboBox选中的值(string类型)
2014-12-31 13:50:11 访问(2039) 赞(0) 踩(0)
/// <summary>
/// 获得ComboBox选中的值(string类型)
/// </summary>
/// <param name="cbb"></param>
/// <returns></returns>
public string ComboBoxGetSelectedStringValue(ComboBox cbb)
{
ComboBoxItem item = cbb.SelectedItem as ComboBoxItem;
if (item == null)
{
throw new Exception
(
"方法:"
+ MethodBase.GetCurrentMethod().ReflectedType.FullName
+ " "
+ MethodBase.GetCurrentMethod().ToString()
+ " 发生异常:" + "ComboBoxItem item = cbb[" + cbb.Name + "].SelectedItem as ComboBoxItem; 为null");
}
return item.Value;
}
标签:
获得ComboBox选中的值(string类型) 


上一条:
下一条:
相关评论
发表评论