以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于datetimepicker控件的疑问  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=81485)

--  作者:free666
--  发布时间:2016/2/29 10:01:00
--  关于datetimepicker控件的疑问
在窗口1里设置了afterload 事件:

Dim Table1 As Table = Tables("人员")
Dim no As Integer = Table1.findrow("[姓名] = \'1\'")
If no >= 0 Then 
    Table1.position = no
End If
Dim r As Row = Table1.current
e.Form.controls("label1").text = r("姓名")
e.Form.controls("label2").text = r("性别")
e.Form.controls("datetimepicker1").value = r("出生日期")

人员表里姓名为"1"的这记录出生日期是没有填的,在窗口1打开后tatetimepicker1却有显示内容"0001-01-01"?
如果想日期输入控件根据出生日期显示,若出生日期没有填时,控件显示为空怎么写啊?

--  作者:大红袍
--  发布时间:2016/2/29 10:03:00
--  
e.Form.controls("datetimepicker1").Text = iif(r.IsNull("出生日期"), Nothing, r("出生日期"))
--  作者:free666
--  发布时间:2016/2/29 10:07:00
--  
原来是这样啊...
这里用value和text的结果都一样,但实际上有什么区别吗?
--  作者:大红袍
--  发布时间:2016/2/29 10:09:00
--  
 value要赋值date,text赋值为string类型。
--  作者:free666
--  发布时间:2016/2/29 10:15:00
--  
后面我用if 判断的时候 , 这样写判断 

if r("出生日期") is nothing then 
  e.form.controls("datetimepicker1").text = nothing 
else
  e.form.controls("datetimepicker1").text = r("出生日期")
end if

发现....is nothing 和 = nothing 出来的结果不一样...具体区别是什么呀?

--  作者:大红袍
--  发布时间:2016/2/29 10:31:00
--  

行的空值,用isnull http://www.foxtable.com/help/topics/1470.htm

 

is nothing,是对象之间的比较

 

一般值的比较(数字、字符、日期),都用 = nothing