[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.
Re: truncate integer in string
The String will always follow that Chars-Numbers Pattern?
Re: truncate integer in string
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?
Re: truncate integer in string
Debug.Print CLng(Split(yourString, "-")(1))
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
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.
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.
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?
Re: truncate integer in string
Yes, result is a string. Simply assign it like you would any other string.
Re: truncate integer in string