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

What is this [] Symbol at the end of my string?

Status
Not open for further replies.

menstroy

MIS
Jun 2, 2003
63
US
Hello,

I have an input box that when a form is loaded I call a function (that was posted on here) that retrieves the username of the current logged on person...

In this one form its doing weird stuff... At first it fills in the name correctly but there is a space after it... Then if I switch over to another window and come back I can see a square after the username and it looks like []...

What is this symbol? I looked at function and it removes blanks from end of it ... But it is not getting rid of this weird character?

Thanks
--------

sBuffer = Space$(255)
lSize = Len(sBuffer)

Call GetUserNameAPI(sBuffer, lSize)

If lSize > 0 Then
' Remove empty spaces
GetUserName = Left$(sBuffer, lSize)
Else
' Return empty if no user is found
GetUserName = vbNullString
End If
 
I'm really not sure what you're trying to do but I've always used Environ("username") to return the name of the person currently logged onto Windows. It simply returns a string of the current login.
If you'd rather just trim [] off what you are getting now you might want to try: Left$(GetUserName,(Len(GetUserName))-2)
 
Well Gez that was easy.. I had all these complex steps that I've read on other post... on how to get the current user logged on...

thread705-569862

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top