Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with string functions

Status
Not open for further replies.

kewlcoder

Programmer
Dec 9, 2003
82
IN
i am using vb6, i am new to programming so need some help with String functions

I am converting a string value into double using the

x=val(str)

and now, i increment it

x = x + 1

now, i want to convert it back to string (i.e, str)

so suppose my string is 0001
i want to get my string back as 0002
and for 0009
i want it as 0010

something like the double x = 1
should be converted into string as 0001 (str ="0001")

please tell me how to do it, is there any seperate function to allow the string to be generated as i want i mean to return in 4 digits

thank you
 


Code:
    s = "0001"
    n = CInt(s)
    n = n + 1
    MsgBox String(Len(s) - Len(CStr(n)), "0") & CStr(n)


Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top