且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

comboBox值

更新时间:2023-01-28 11:12:36

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

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!