Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this code. I look at it but not sure its the best. I'm joining address lines, getting rid of blanks. Has anybody got any ideas to improve this? Thanks!

                If A2 <> "" Then A2 = ", " & A2
                If A3 <> "" Then A3 = ", " & A3
                If A4 <> "" Then A4 = ", " & A4
                If A5 <> "" Then A5 = ", " & A5
                If A6 <> "" Then A6 = ", " & A6
                If A7 <> "" Then A7 = ", " & A7
Dim Line1 As String = A2 & A3 & A4 & A5 & A6 & A7


What I have tried:

Nothing yet, short of ideas! Stringbuilder?
Posted
Updated 30-Aug-17 0:15am
v4
Comments
OriginalGriff 30-Aug-17 5:36am    
I'd post that as the solution...
[no name] 30-Aug-17 5:40am    
It was only a lucky Google shot. In case OP has a question, I can't help, therefore I let it as a comment :)Feel free to use the link in an answer.
OriginalGriff 30-Aug-17 5:47am    
And he's happy - post it up! :laugh:

(I've got enough rep points, you could use a bit of boosting to get your "Authority" rating up to platinum)
[no name] 30-Aug-17 6:16am    
10 Rep more at the Moment, hopefully no down voters on tour :laugh:

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900