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

问题描述

如何从数据视图填充文本框?我有一个数据集,我正在过滤

,我想基于该过滤器填充几个文本框。


我怎样才能让它工作?


我试过了:


dsDetails = GetCars()

dvDetails =新DataView

使用dvDetails

。表= dsDetails.Tables(0)

.RowFilter =" CARMAKE =" &安培; "" &安培; strModel&安培; "''"

结束

txtName.DataBindings(" NAME")。ToString()


和我收到此错误

对象引用未设置为对象的实例


或我得到:


这会导致集合中的两个绑定绑定到同一个属性

参数名称:绑定


我正在使用此代码

txtName.DataBindings.Add(New Binding(" Text",dvDetails," NAME"))


我错过了什么或者这不是完成了吗?

How can I populate a textbox from a dataview? I have a dataset i''m filtering
on and i want to populate several textboxes based on that filter.

How can i get that to work?

I''ve tried:

dsDetails = GetCars()
dvDetails = New DataView
With dvDetails
.Table = dsDetails.Tables(0)
.RowFilter = "CARMAKE=" & "''" & strModel& "''"
End With
txtName.DataBindings("NAME").ToString()

and i get this error(s)
Object reference not set to an instance of an object

or I get:

This would cause tow bindings in the collection to bind to the same property
Parameter name: binding

and i''m using this code
txtName.DataBindings.Add(New Binding("Text", dvDetails, "NAME"))

am I missing something or can this not be done?

推荐答案





你知道吗,你输入更多字符并且使用了一个额外的

指令(不是最后一个在我的想法中很重要)。


而忙碌的代码可以显示命名"在txtName中确认

the currencymanager

\\\

dsDetails = GetCars()

dvDetails as New DataView(dsDetails.Tables(0))

dvDetails.RowFilter =" CARMAKE =" &安培; "" &安培; strModel&安培; "''"

txtName.DataBindings.Add(New Binding(" Text",dvDetails," NAME"))

///

我希望这有帮助吗?


Cor


You know that with this you type more characters and is used one extra
instruction (not that the last is in my idea important).

And while busy your code can be to show the "name" in the txtName confirm
the currencymanager
\\\
dsDetails = GetCars()
dvDetails as New DataView(dsDetails.Tables(0))
dvDetails.RowFilter = "CARMAKE=" & "''" & strModel& "''"
txtName.DataBindings.Add(New Binding("Text", dvDetails, "NAME"))
///
I hope this helps?

Cor



过滤


property


property




这篇关于从dataview填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 20:07