P
pvong
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
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