Solved

trim not trimming in vb.net

Posted on 2016-07-27
2
24 Views
Last Modified: 2016-07-27
I have this loop which creates the string but leaves a space at the end.
The Chr(32) is putting the space in between the words.
How can I get it not to leave a space at the end.

  For Each drRecordW As DataRow In dtCodeWords.Rows
                    StrShortString = StrShortString & drRecordW("word") & Chr(32)
                    RTrim(StrShortString)
                    Debug.Print(StrShortString)
                Next

Open in new window

0
Comment
Question by:PeterBaileyUk
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
you need to store the result back into the variable:
StrShortString = RTrim(StrShortString)

Open in new window

0
 

Author Closing Comment

by:PeterBaileyUk
Comment Utility
thank you!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now