[RESOLVED] How to change variable integer to string variable
Hi all,
I have a variable as a number
Dim Number1 as integer
Dim Charecter1 as string
ex.
Number1= "12345"
after vb code will be
charecter1 = "12345"
which at the end i will be converting all my number variable to be as charecter varible.
Thanks in advance for your help. :afrog:
Re: How to change variable integer to string variable
VB Code:
Dim Number1 as integer
Dim Charecter1 as string
Number1= 12345
charecter1 = Number1.ToString()
You don't need double quotes when you assign a number. And there is bui;t in method ToString that will convert it to the string.
Re: How to change variable integer to string variable
out of interest is it faster to use the toString method compared with the CType() method?
Thanks
Re: How to change variable integer to string variable
Quote:
Originally Posted by Shuja Ali
VB Code:
Dim Number1 as integer
Dim Charecter1 as string
Number1= 12345
charecter1 = Number1.ToString()
You don't need double quotes when you assign a number. And there is bui;t in method ToString that will convert it to the string.
Hi ,
sorry brother is i think tostring is not for VB6:(
but i did fine out cstr for vb6 but i keep getting error overflow:(
VB Code:
Number1 = Words(Counter) <---- here where i get overflow error
T1 = CStr(Number1)
Charecter1 = T1
MsgBox T1
MsgBox Charecter1
Words(Counter) = Charecter1
'Debug.Print Words(Counter)
T = T & " " & Words(Counter)
thanks any way for you help brother.
Re: How to change variable integer to string variable
Quote:
Originally Posted by andakali
Hi ,
sorry brother is i think tostring is not for VB6:(
but i did fine out cstr for vb6 but i keep getting error overflow:(
VB Code:
Number1 = Words(Counter) <---- here where i get overflow error
T1 = CStr(Number1)
Charecter1 = T1
MsgBox T1
MsgBox Charecter1
Words(Counter) = Charecter1
'Debug.Print Words(Counter)
T = T & " " & Words(Counter)
thanks any way for you help brother.
the words(counter) was = 14801110073
Re: How to change variable integer to string variable
This is the vb.net forum.
As for vb6
VB Code:
dim inumber as integer
dim istring as string
inumber = 12345
istring = Cstr(inumber)
Will work.
http://www.vbforums.com/showpost.php...1&postcount=15
Pino
Re: How to change variable integer to string variable
Quote:
Originally Posted by andakali
Hi ,
sorry brother is i think tostring is not for VB6:(
but i did fine out cstr for vb6 but i keep getting error overflow:(
This is VB.NET Forum and I posted VB.NET code. :)