I have a listview in vb6 containing the column ID, the values of ID are PID-id where id is equal to id in my database. Ex. PID-56, PID-57. What i want is when i get the value of column id, first value in my listview , let's say PID-56, I only want the ID part which is equal to 56.
Ex.
value=.text --> PID-56
newvalue=56 --> PID- is not included so 56 now can be a integer.
How can i remove the 'PID-' considering I am using LIstview in vb6.
What function shoul i be using?
If you know that the string always starts with
PID-
and that format won't ever change, then you can use one of the Basic string manipulation functions. In this case, you probably want to pair theRight
function with theLen
function. TheLen
function will return the length of the string (the total number of characters that it contains), and theRight
function will return the substring of the specified length, starting from the right side of the whole string.Finally, you'll need to use one of the standard value conversions to convert that string value into a numeric value. In this case, naturally, you want the
CInt
operator.For example: