问题描述
VB.Net
我从数据库中提取数据并通过填写标签创建一个字母。它
完美无缺,但如果Addr2和Addr3为空,则在该区域留下一个空格
。有没有办法让它如此我可以说数据是否为空,
暂时删除标签或使其不存在?我不是在谈论
只是隐藏它因为它仍然留下了一个空间。
这就是我得到的:
FirstName LastName
Addr1
Addr2(如果没有数据,这是空白的)
Addr3(如果没有数据,这是空白的)
City,State ZIP
这是我想要的Addr2& Addr3是空白的:
FirstName LastName
Addr1
City,State ZIP
这是我的代码:
如果不是dr.Item(" CustodianAddress2")。ToString = String.Empty那么
CustAddr2L.Text = dr.Item(" CustodianAddress2")
结束如果
如果不是dr.Item(" CustodianAddress3")。ToString = String.Empty那么
CustAddr3L.Text = dr.Item(" CustodianAddress3")
结束如果
VB.Net
I''m pulling Data from a DB and creating a letter by filling the Labels. It
works perfectly, but if Addr2 and Addr3 are blank, it leaves a Blank space
in that area. Is there a way to make it so I can say if the data is empty,
temporarely delete the label or make it not exist at all? I''m not talking
about just hiding it because it still leaves an empy space.
This is what I get:
FirstName LastName
Addr1
Addr2 (this is blank if no data)
Addr3 (this is blank if no data)
City, State ZIP
This is what I want to get if Addr2 & Addr3 are blank:
FirstName LastName
Addr1
City, State ZIP
Here is my Code:
If Not dr.Item("CustodianAddress2").ToString = String.Empty Then
CustAddr2L.Text = dr.Item("CustodianAddress2")
End If
If Not dr.Item("CustodianAddress3").ToString = String.Empty Then
CustAddr3L.Text = dr.Item("CustodianAddress3")
End If
推荐答案
这篇关于让地址看起来更好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!