Click to See Complete Forum and Search --> : Number to Text


Pat S
September 25th, 2001, 02:57 PM
Is it possible to "trick" my app into thinking that my numeric ID is actually text? If so, how?
Thanks

DSJ
September 25th, 2001, 03:02 PM
Dim x As Integer
x = 1000
MsgBox CStr(x) = "1000"

srinika
September 25th, 2001, 10:02 PM
2 Ways (Assume - 4562 is the numeric ID)

1. USing CStr(4562) - Convert(cast) to String
2. Using the following format : 4562 & ""

Srinika

Cakkie
September 26th, 2001, 09:24 AM
Well, there are some tricks to do so, like using CStr and stuff, but if it is for using as the key of a node in a treeview (I assume this cause of your previous posts), i'm affraid to disappoint you.
The treeview will just not take it, probably because it then doesn't if you are talking about the index (numeric) or the key (string), since both are passed as variant, which could be any.

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Boumxyz2
September 26th, 2001, 12:11 PM
private Sub Command2_Click()
Dim temp1, temp3, temp4 as Integer
Dim temp5 as string

temp1 = 123
temp3 = 1
temp5 = ""
temp4 = 0

While temp1 > 0
temp4 = temp1 Mod 10
temp1 = temp1 - temp4
temp1 = temp1 / 10
temp3 = temp3 + 1
MsgBox (temp4)
' Convertir temp4 en char
temp5 = temp5 + Chr(temp4 + 48)
Wend
MsgBox (StrReverse(temp5))

End Sub




But the compiler does it by itself ( casting ).