Welcome to Dream.In.Code
Become a VB Expert!

Join 137,228 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,959 people online right now. Registration is fast and FREE... Join Now!




Visual Basic Help

 
Reply to this topicStart new topic

Visual Basic Help

Bob bob
8 Mar, 2007 - 07:34 AM
Post #1

New D.I.C Head
*

Joined: 8 Mar, 2007
Posts: 1


My Contributions
I am having a problem with my Visual Basic program, i am trying to take the last 6 letters/numbers off of a username and display it in a label. However when i try to use the left right functions it wont work.
For example

username = WallaceW468P01
Label1.caption = username - Left(username, 6)


As you can see im trying to remove 468P01 from the name, and other usernames however the usernames are different lengths but it is always the last 6 characters i need to remove.
I tried searching forum and couldn't find anything, appologies if i missed it.
Im sure it is a simple mistake i am making please help!
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Visual Basic Help
8 Mar, 2007 - 07:51 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
Something like the following should work:
CODE

Label1.caption = Left(Len(username)-6)

User is offlineProfile CardPM
+Quote Post

m2s87
RE: Visual Basic Help
8 Mar, 2007 - 11:35 AM
Post #3

D.I.C Regular
Group Icon

Joined: 28 Nov, 2006
Posts: 390



Thanked: 1 times
Dream Kudos: 1225
My Contributions
There are many string functions, but i like to use Mid(), so it would be
CODE

Label1.caption = Mid(username,Len(username)-6,6)

or
CODE

Label1.caption = right(username,6)

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 02:51PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month