|
-
Dec 4th, 2001, 04:39 PM
#1
Thread Starter
Lively Member
Changing value of a label
OK say I have a label that is currently containing a value C102
but I want to extract that data Add 1 to it so it is now C103.
I would probably want to take only the 2-4 char's of the label which are number, and do 102+1 = 103 and then do label = "C" & (new value(103))
How would I go about doing that, I'm a little rusty when it comes to doing this.
even pointing me in right direction might help me remember the code.
Thanks
Vini, Vidi, Vici!
-----------------
say this 5 times fast
"I am not a pheasant plucker, I'm a pheasant plucker's son. I'm only plucking pheasants, till the pheasant plucker comes."
-
Dec 4th, 2001, 04:43 PM
#2
-= B u g S l a y e r =-
VB Code:
Private Sub Command2_Click()
Label1.Caption = "C" & Val(Mid(Label1.Caption, 2, Len(Label1.Caption) - 1)) + 1
End Sub
that was ugly coding
-
Dec 4th, 2001, 04:44 PM
#3
Need-a-life Member
VB Code:
Label1.Caption = "C" & Format(Mid(Label1.Caption, 2) + 1)
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Dec 4th, 2001, 04:48 PM
#4
Addicted Member
...and that was one of a few I could have answered...
...........if only I was faster
-
Dec 4th, 2001, 04:48 PM
#5
Thread Starter
Lively Member
Thanks, it was the Val command that I was trying to remember, It works, I remember you could set it up with left, mid, right I think. But Thanks again.
This is why I love this place quick responses.
Vini, Vidi, Vici!
-----------------
say this 5 times fast
"I am not a pheasant plucker, I'm a pheasant plucker's son. I'm only plucking pheasants, till the pheasant plucker comes."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|