?
Solved

vb.net remove commas at end of address if not all fields are entered

Posted on 2012-09-07
2
Medium Priority
?
453 Views
Last Modified: 2012-09-10
I have to concatenate 5 fields into one string to create an address that is entered into one field in a database.  When not all of the fields are entered, I get commas at the end of the string, i.e. "555 North Ave, , , "   How can I removed these before saving?  It is not a matter of saving to different fields...I am working with old code and old tables that already have thousands of addresses that were saved to one field and I cannot change that.  I also cannot require all address fields have data.  I just want the save to the one address field as clean as possible.   Thanks for your help in advance.
0
Comment
Question by:McGurk1
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 38378500
You can do:

    str = str.TrimEnd(",")
0
 

Author Closing Comment

by:McGurk1
ID: 38383691
Thanks for the help.  This does only get rid of the last ","  but is heading in the right direction.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question