comboBox值 [英] comboBox value

查看:76
本文介绍了comboBox值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您好,我正在尝试获取comboBox值,但是当我写作时:

MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring()) ;

我得到以下结果:

System.Data.DataRowView

而不是选定的值。为什么?

***通过开发人员指南 http://www.developersdex发送。 com ***

不要只是参加USENET ......获得奖励!

解决方案

你会得到那个价值因为你的数据绑定到

ComboBox而被退回。将SelectedValue转换为DataRowView,然后您可以从Row属性和所需列中获取

适当的值。


-

Tim Wilson

..Net Compact Framework MVP


" juli jul" <菊****** @ yahoo.com>在消息中写道

news:en ************** @ tk2msftngp13.phx.gbl ...


你好,我正在尝试获取comboBox值但是当我写作时:
MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring());
我得到以下结果:
系统.Data.DataRowView
而不是选定的值。为什么?

***通过开发人员指南 http://www.developersdex发送。 com ***
不要只是参加USENET ......获得奖励!



你''得到那个价值因为你的数据绑定到

ComboBox而被退回。将SelectedValue转换为DataRowView,然后您可以从Row属性和所需列中获取

适当的值。


-

Tim Wilson

..Net Compact Framework MVP


" juli jul" <菊****** @ yahoo.com>在消息中写道

news:en ************** @ tk2msftngp13.phx.gbl ...


你好,我正在尝试获取comboBox值但是当我写作时:
MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring());
我得到以下结果:
系统.Data.DataRowView
而不是选定的值。为什么?

***通过开发人员指南 http://www.developersdex发送。 com ***
不要只是参加USENET ......获得奖励!



谢谢,但我铸造失败 - 我怎么能这样做(我试图创建新的

DataRowView而不是将SelectedValue指向它但它没有工作)

怎么办它?

谢谢!


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!


Hello ,I am trying to get the comboBox value but when I am writing:
MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring());
I get the following result:
System.Data.DataRowView
instead of the selected value . Why?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

解决方案

You''ll get that "value" being returned because you''re data binding to the
ComboBox. Cast the SelectedValue to a DataRowView and then you can get the
appropriate value from the Row property and desired column.

--
Tim Wilson
..Net Compact Framework MVP

"juli jul" <ju******@yahoo.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...


Hello ,I am trying to get the comboBox value but when I am writing:
MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring());
I get the following result:
System.Data.DataRowView
instead of the selected value . Why?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



You''ll get that "value" being returned because you''re data binding to the
ComboBox. Cast the SelectedValue to a DataRowView and then you can get the
appropriate value from the Row property and desired column.

--
Tim Wilson
..Net Compact Framework MVP

"juli jul" <ju******@yahoo.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...


Hello ,I am trying to get the comboBox value but when I am writing:
MessageBox.Show(this.comboBoxdb.SelectedValue.ToSt ring());
I get the following result:
System.Data.DataRowView
instead of the selected value . Why?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



Thanks but I the casting fails - how can I do it (I tried to create new
DataRowView and than asign the SelectedValue to it but it didn''t work)
How to do it?
Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于comboBox值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆