以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]请问空值如何跟字符串连接  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=177489)

--  作者:moseser
--  发布时间:2022/5/24 15:55:00
--  [求助]请问空值如何跟字符串连接
事情如下
我通过做了两个  iff ( 条件   ,空值  ,结果是:  );
最终我想把两辆 iff 的结果 连接成字符串,发现,当条件成立是,为空值的时候,无法正常的连接成字符串
想问一下,如果将空值跟正常的字符串连接起来

--  作者:狐狸爸爸
--  发布时间:2022/5/24 16:00:00
--  
如果是表达式:

iff ( 条件  ,\'\' ,结果)

注意是两个单引号,不是双引号。




--  作者:moseser
--  发布时间:2022/5/24 16:05:00
--  回复:(狐狸爸爸)如果是表达式:iff ( 条件  ...
Dim t1 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text1")
Dim t2 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text2")
Dim t3 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text3")


Dim r1 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("jytxt")
Dim r2 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("sytxt")
Dim r3 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("cost")


Dim t1_txt As String = IIF(t1.Text.Length = 0 ,\'\'," 类别: "& t1.text &" " )
Dim t2_txt As String = IIF(t1.Text.Length = 0 ,\'\'," 名称: "& t2.text &" " )
Dim t3_txt As String = IIF(t1.Text.Length = 0 ,\'\'," 规格型号: "& t3.text &" " )

Dim j As String = t1_txt & t2_txt & t3_txt

Dim r1_txt As String = r1.Text
Dim r2_txt As String = r2.Text
Dim r3_txt As String = r3.Text

Tables("查询表").AddNew

Dim r As Row = Tables("查询表").Current
r("内容") = j
r("净用量") = r1_txt
r("实用量") = r2_txt
r("不含税合计") = r3_txt

改成单引号后报错

--  作者:有点蓝
--  发布时间:2022/5/24 16:18:00
--  
代码使用双引号,表达式才是单引号
--  作者:moseser
--  发布时间:2022/5/24 16:19:00
--  回复:(有点蓝)代码使用双引号,表达式才是单引号
Dim t1 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text1")
Dim t2 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text2")
Dim t3 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("text3")


Dim r1 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("jytxt")
Dim r2 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("sytxt")
Dim r3 As RibbonMenu.TextBox = RibbonTabs("detail").Groups("汇总").Items("cost")


Dim t1_txt As String = IIF(t1.Text Is Nothing ,"丨"," 类别: "& t1.text &" " )
Dim t2_txt As String = IIF(t1.Text Is Nothing ,"丨"," 名称: "& t2.text &" " )
Dim t3_txt As String = IIF(t1.Text Is Nothing ,"丨"," 规格型号: "& t3.text &" " )




Dim j As String = t1_txt & t2_txt & t3_txt

Dim r1_txt As String = r1.Text
Dim r2_txt As String = r2.Text
Dim r3_txt As String = r3.Text

Tables("查询表").AddNew

Dim r As Row = Tables("查询表").Current
r("内容") = j
r("净用量") = r1_txt
r("实用量") = r2_txt
r("不含税合计") = r3_txt

用nothing ,怎么也都执行最后面的语句

--  作者:有点蓝
--  发布时间:2022/5/24 16:21:00
--  
Dim t1_txt As String = IIF(t1.Text = "" ,"丨"," 类别: "& t1.text &" " )
--  作者:moseser
--  发布时间:2022/5/24 16:25:00
--  回复:(有点蓝)Dim t1_txt As String = IIF(t1.Text...
已解决,谢谢