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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trimming Data 1

Status
Not open for further replies.

sila

Technical User
Aug 8, 2003
76
0
0
GB
Hi
I am needing to trim out empty spaces in my datafield before the code below. I thought Trim(lit1.Text) would do this but this does not work
Code:
Trim(lit1.Text)
            If IsDBNull(lit1.Text) Or lit1.Text = "" Then
                lit1.Text = ""
            Else
                lit1.Text = lit1.Text & " " & " <br>"
            End If

Thanks
 
try...
Code:
lit1.Text = Trim(lit1.Text)
            If IsDBNull(lit1.Text) Or lit1.Text = "" Then
                lit1.Text = ""
            Else
                lit1.Text = lit1.Text & " " & " <br>"
            End If

The Trim(lit1.Text) will do exactly what you expect and trim lit1.Text, but unless you set the value of lit1.Text to Trim(lit1.Text), then lit1.Text will still have leading and trailing spaces :)

Rhys

"Vampireware /n/,a project, capable of sucking the lifeblood out of anyone unfortunate enough to be assigned to it, which never actually sees the light of day, but nonetheless refuses to die."

"I see dead pixels!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top