Listbox entering a leading space

I have a listbox where one record has a leading space (maybe two) on one cell (first_name). No other cells have this problem.

The data is being fed by a postgres 9.1 database with a simple command:

lb.AddRow(rs.Field("PtNumber").StringValue,rs.Field("LastName").StringValue,rs.Field("FirstName").StringValue)

I check the data in pgAdmin3 and Navicat and both show no leading spaces in the first_name column.

I am guessing that somehow an extraneous non-visible character (in pgAdmin3 and Navicat) was somehow entered that Xojo is showing as a space.

Neither re-entering the field nor performing a Trim on the field seems to fix this.

Any ideas on how to find out if this is correct and possibly correct this?

do this as a test

dim s as string=rs.Field("FirstName").StringValue
break

then examine the value of s using the debugger to see what is really there (hex wise)

Apply Trim:

lb.AddRow(rs.Field("PtNumber").StringValue.Trim

Or use a database editor and sort the table by first name so that the suspected records appear on top and then correct the values manually.

He already mentioned that didn’t solve the problem

[quote=298715:@Dave S]do this as a test

dim s as string=rs.Field(“FirstName”).StringValue
break
then examine the value of s using the debugger to see what is really there (hex wise)[/quote]
Interestingly enough, what this turned out to be was I was looking at the wrong table. This is a very old database that was ported over. The original design used the name in more than one table. I know better now.