以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]窗口控件查找与赋值问题?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=28955)

--  作者:红颜
--  发布时间:2013/2/23 18:50:00
--  [求助]窗口控件查找与赋值问题?

Dim D As Double = Forms("找零计算").Controls("NumericComboBox1").Value
Dim S As String = Forms("找零计算").Controls("ComboBox3").Value     Dim dr As DataRow
dr = DataTables("项目设置").Find("[项目名称]  = \'" & e.form.Controls("ComboBox3").Value & "\'")   

If dr IsNot Nothing Then
    D = dr("单价")        

End If

如此代码如何写才正确?

(在ComboBox3中输入项目名称)

 在“在项目设置”表中查找。

如果存在,Forms("找零计算").Controls("NumericComboBox1").Value
的值是“项目设置”表中对应的价格


--  作者:双轨制
--  发布时间:2013/2/23 20:19:00
--  
Dim dr As DataRow
dr = DataTables("项目设置").Find("[项目名称]  = \'" & e.form.Controls("ComboBox3").Value & "\'")  
If dr IsNot Nothing Then
    Forms("找零计算").Controls("NumericComboBox1").Value =  = dr("单价")        
End If

--  作者:红颜
--  发布时间:2013/2/23 23:25:00
--  
以下是引用双轨制在2013-2-23 20:19:00的发言:
Dim dr As DataRow
dr = DataTables("项目设置").Find("[项目名称]  = \'" & e.form.Controls("ComboBox3").Value & "\'")  
If dr IsNot Nothing Then
    Forms("找零计算").Controls("NumericComboBox1").Value = dr("单价")        
End If

 

 

代码还是有问题,提示如下:


图片点击可在新窗口打开查看此主题相关图片如下:未命名.jpg
图片点击可在新窗口打开查看

 

我的代码放在ComboBox3的Leave 事件中。


 


--  作者:红颜
--  发布时间:2013/2/24 1:11:00
--  
问题已解决,谢谢!