trim not trimming in vb.net

PeterBaileyUk
PeterBaileyUk used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior .Net Consultant
Top Expert 2016
Commented:
you need to store the result back into the variable:
StrShortString = RTrim(StrShortString)

Open in new window

Author

Commented:
thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start Today