473,804 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make Address Look Better

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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.Text = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.Text = dr.Item("Custod ianAddress3")

End If
Oct 9 '07 #1
13 1457
Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.

"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******** ******@TK2MSFTN GP02.phx.gbl...
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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.Text = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.Text = dr.Item("Custod ianAddress3")

End If


Oct 9 '07 #2
What do I put in there so it will include a <BRto it's not all on the same
line? This is my new code and they all run together. I know how to put 1
space in between, but how do you put a return character?
CustAddr1L.Text = dr.Item("Custod ianAddress1") &
dr.Item("Custod ianAddress2") & dr.Item("Custod ianAddress3")

"IfThenElse " <sq**********@h otmail.comwrote in message
news:er******** ******@TK2MSFTN GP05.phx.gbl...
Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.

"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******** ******@TK2MSFTN GP02.phx.gbl...
>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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.Tex t = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.Tex t = dr.Item("Custod ianAddress3")

End If



Oct 9 '07 #3
I'm using WebForm if that matters.
"IfThenElse " <sq**********@h otmail.comwrote in message
news:er******** ******@TK2MSFTN GP05.phx.gbl...
Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.

"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******** ******@TK2MSFTN GP02.phx.gbl...
>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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.Tex t = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.Tex t = dr.Item("Custod ianAddress3")

End If



Oct 9 '07 #4
On Oct 9, 7:00 pm, "pvong" <phillip*at*yah oo*dot*comwrote :
What do I put in there so it will include a <BRto it's not all on the same
line? This is my new code and they all run together. I know how to put 1
space in between, but how do you put a return character?
CustAddr1L.Text = dr.Item("Custod ianAddress1") &
dr.Item("Custod ianAddress2") & dr.Item("Custod ianAddress3")

"IfThenElse " <sql_agent...@h otmail.comwrote in message

news:er******** ******@TK2MSFTN GP05.phx.gbl...
Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.
"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******** ******@TK2MSFTN GP02.phx.gbl...
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("Custod ianAddress2").T oString = String.Empty Then
CustAddr2L.Text = dr.Item("Custod ianAddress2")
End If
If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then
CustAddr3L.Text = dr.Item("Custod ianAddress3")
End If- Hide quoted text -

- Show quoted text -
if blank means null

CustAddr1L.Text = dr.Item("Custod ianAddress1") _
& IsDBNull(dr.Ite m("CustodianAdd ress2"), "", "<br>" &
dr.Item("Custod ianAddress2"))
& IsDBNull(dr.Ite m("CustodianAdd ress3"), "", "<br>" &
dr.Item("Custod ianAddress3"))

Oct 9 '07 #5
Just put asp:Label controls on the WebForm where you will want the
appropriate content to go (using a table for presice layout is a great
idea). Then just pull out the data from your DataReader and put it into the
appropriate label. No need to fuss with <BRat all.
"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OV******** ******@TK2MSFTN GP03.phx.gbl...
I'm using WebForm if that matters.
"IfThenElse " <sq**********@h otmail.comwrote in message
news:er******** ******@TK2MSFTN GP05.phx.gbl...
>Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.

"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******* *******@TK2MSFT NGP02.phx.gbl.. .
>>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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.Te xt = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.Te xt = dr.Item("Custod ianAddress3")

End If




Oct 9 '07 #6
See my reply to pvong. Adding HTML <BRtags is sooooo Classic ASP. Use
labels instead.


"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** ************@o8 0g2000hse.googl egroups.com...
On Oct 9, 7:00 pm, "pvong" <phillip*at*yah oo*dot*comwrote :
>What do I put in there so it will include a <BRto it's not all on the
same
line? This is my new code and they all run together. I know how to put
1
space in between, but how do you put a return character?
CustAddr1L.Tex t = dr.Item("Custod ianAddress1") &
dr.Item("Custo dianAddress2") & dr.Item("Custod ianAddress3")

"IfThenElse " <sql_agent...@h otmail.comwrote in message

news:er******* *******@TK2MSFT NGP05.phx.gbl.. .
Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.
"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD******* *******@TK2MSFT NGP02.phx.gbl.. .
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("Custod ianAddress2").T oString = String.Empty Then
>CustAddr2L.Tex t = dr.Item("Custod ianAddress2")
>End If
>If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then
>CustAddr3L.Tex t = dr.Item("Custod ianAddress3")
>End If- Hide quoted text -

- Show quoted text -

if blank means null

CustAddr1L.Text = dr.Item("Custod ianAddress1") _
& IsDBNull(dr.Ite m("CustodianAdd ress2"), "", "<br>" &
dr.Item("Custod ianAddress2"))
& IsDBNull(dr.Ite m("CustodianAdd ress3"), "", "<br>" &
dr.Item("Custod ianAddress3"))

Oct 9 '07 #7
Scott, that's my problem to begin with. I do have labels and all the data
are flowing correctly, but it leaves a blank space where the Label is for
Address2 and 3 which is what I'm trying to avoid.

Can you take my code and show me how you would do it with multiple labels?
"Scott M." <s-***@nospam.nosp amwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Just put asp:Label controls on the WebForm where you will want the
appropriate content to go (using a table for presice layout is a great
idea). Then just pull out the data from your DataReader and put it into
the appropriate label. No need to fuss with <BRat all.
"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OV******** ******@TK2MSFTN GP03.phx.gbl...
>I'm using WebForm if that matters.
"IfThenElse " <sq**********@h otmail.comwrote in message
news:er******* *******@TK2MSFT NGP05.phx.gbl.. .
>>Don't use CustAddr2L and CustAddr3L Just add everything to CustAddr1L
if CustAddr2L and CustAddr3L exit then add then to CustAddr1L
This way you don't need to remove anything.

"pvong" <phillip*at*yah oo*dot*comwrote in message
news:OD****** ********@TK2MSF TNGP02.phx.gbl. ..
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("Custod ianAddress2").T oString = String.Empty Then

CustAddr2L.T ext = dr.Item("Custod ianAddress2")

End If

If Not dr.Item("Custod ianAddress3").T oString = String.Empty Then

CustAddr3L.T ext = dr.Item("Custod ianAddress3")

End If




Oct 9 '07 #8
On Oct 9, 8:04 pm, "pvong" <phillip*at*yah oo*dot*comwrote :
Scott, that's my problem to begin with. I do have labels and all the data
are flowing correctly, but it leaves a blank space where the Label is for
Address2 and 3 which is what I'm trying to avoid.

Can you take my code and show me how you would do it with multiple labels?
The only thing you can do is to make an "empty" label invsible when it
has no text. It would help to make no empty line.

Oct 9 '07 #9
On Oct 9, 8:25 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On Oct 9, 8:04 pm, "pvong" <phillip*at*yah oo*dot*comwrote :
Scott, that's my problem to begin with. I do have labels and all the data
are flowing correctly, but it leaves a blank space where the Label is for
Address2 and 3 which is what I'm trying to avoid.
Can you take my code and show me how you would do it with multiple labels?

The only thing you can do is to make an "empty" label invsible when it
has no text. It would help to make no empty line.
invsible = invisible

Oct 9 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
3851
by: Bruce W...1 | last post by:
This is a best practices question. For a website where PHP is used, does it make sense to have both .htm and .php files? In other words, for pages that have no active content there's no point in naming them with a .php extension. Is there any advantage or disadvantage to making all files .php, or the same for mixing them with .htm files? What do you do, and why?
7
17954
by: gurtd_dauberie | last post by:
I can't get the correct IP address on Linux... The following code works properly on Windows and Unix. But on Linux, I always get the Loopback Address (127.0.0.1) Here is the code : //gets the IP via InetAddress class //works on UNIX and WIN, but not on LINUX !! InetAddress hostIP = InetAddress.getLocalHost(); String hostIPStr = hostIP.getHostAddress();
8
2167
by: Maciej Wegorkiewicz | last post by:
Hi, I have small experience in XSLT processing and I have a problem which I cannot solve. Can you look at it? I have an input file containing info about bank accounts like this: (...) <acc id="1"> <balance>100</balance>
12
3307
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would influence the opinions of others, and I really want to know how other people view these things,...
13
3595
by: seemanta dutta | last post by:
Greetings C gurus, I have used preprocessor directives since a very long time. But whenever I see some professional piece of C code, the linux kernel for example, I get literally confused by the amount of preprocessor directives used in these code. Can anyone please tell me how to actually use these preprocessor directives in a more professional way like selecting particular lines of code suited for some particular hardware etc...
35
10801
by: hasho | last post by:
Why is "call by address" faster than "call by value"?
6
4906
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
4
2028
by: robinsand | last post by:
Header File: car.h #if !defined CAR_H #define CAR_H enum TCarType { ctEconomy = 1, ctCompact, ctStandard, ctFullSize, ctMiniVan, ctSUV }; class Car { public: Car();
6
3408
by: BA | last post by:
Hi Everyone, I have an application that sits behind a server farm, the application needs to pass its NLB IP address in the message that it sends to another service. From C# code, how can I determine the IP address of the network load balanced machine that the message is generated from? So, in essence, I have server1, server2 and server3 sitting behind the NLB IP address 100.1.2.100, then I have server4 and server5 sitting behind NLB...
11
5936
by: timber910 | last post by:
hello all, I'm trying to figure out a good way to compare address across two tables. Example: Table 1 has the address of 12345 E Main St and table 2 has 12345 Main. I need to just look at the numbers and actual street. If they match than I'm good. I've done the below Expr2: Left(!,InStr(!," ")-1) to split out the numbers, and I can keep going deeper with something like this, but wanted to know if anyone else has a better query...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.