Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataFormat/Removing Blanks from Text Boxes 1

Status
Not open for further replies.

bdavis96

Programmer
Joined
Feb 11, 2002
Messages
97
Location
US
I know that for numbers, you can DataFormat objects with # or 0 depending on whether you want 0s to show in that object. Is there a same thing for characters and whether or not you are showing spaces/blanks?

My problem is that RPG3 will blank out fields with spaces when stored on the AS400, but then I use VB to pull it onto a PC and show it in objects (textboxes, labels, etc) and those spaces are there. So if you click anywhere in a text box, the cursor will show where you clicked, not at the beginning of the text box.

Is there a function check, compare statement or DataFormat that I can use to get rid of those blanks? The best I have come up with is:

If txtTest.Text = " " Then
txtTest.Text = ""
End If

The " " is however many spaces the field in RPG3 is, since you have to define field lengths.
 
txtTest.Text = trim$(txtTest.Text)
 
Or, if you need to retain any leading spaces that may appear in those values, use the function that trims only spaces on the right:

Code:
txtTest.Text = RTrim$(txtTest.Text)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top