|
-
Jul 10th, 2007, 09:56 AM
#1
Thread Starter
Lively Member
[RESOLVED] truncate integer in string
hello, is it possible to truncate or get the value of a number in a string? i have a combobox that displays varchar values from the database for example MNG-5.
i want to get the number 5 and maybe put it in a label or a textbox, is it possible? thanks.
-
Jul 10th, 2007, 09:59 AM
#2
Re: truncate integer in string
The String will always follow that Chars-Numbers Pattern?
-
Jul 10th, 2007, 10:00 AM
#3
Thread Starter
Lively Member
Re: truncate integer in string
-
Jul 10th, 2007, 10:00 AM
#4
Re: truncate integer in string
Will that always be the format? Will there always be a dash preceding the number? Will the number be always at the rightmost portion of string?
-
Jul 10th, 2007, 10:01 AM
#5
Re: truncate integer in string
Debug.Print CLng(Split(yourString, "-")(1))
-
Jul 10th, 2007, 10:03 AM
#6
Thread Starter
Lively Member
Re: truncate integer in string
Debug.Print? can you use that in vb6? I'm sorry i must have forgotten that i am using vb6 hehe
-
Jul 10th, 2007, 10:07 AM
#7
Re: truncate integer in string
Just a way to show the output. Debug.Print outputs to the IDE's immediate window. You can use MsgBox if you prefer.
-
Jul 10th, 2007, 10:09 AM
#8
Re: truncate integer in string
In this case you won't need CLng() since you want the result to be String Format to add it to a TextBox or Label.
-
Jul 10th, 2007, 10:09 AM
#9
Thread Starter
Lively Member
Re: truncate integer in string
Oh. but is it possible to get the value of the integer and store it somewhere? like maybe in a label or a textbox?
-
Jul 10th, 2007, 10:21 AM
#10
Re: truncate integer in string
Yes, result is a string. Simply assign it like you would any other string.
-
Jul 10th, 2007, 11:04 AM
#11
Thread Starter
Lively Member
Re: truncate integer in string
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
|