Click to See Complete Forum and Search --> : how to convert texfield value to numeric?


wayne.kw
06-21-2005, 04:04 AM
hi, may i know how to convert texfield value to numeric? because i need the value to compare with others numeric/integer to do my condition!

this is because the value in textfield is in charater, so i cant compare it with others numeric! pls...help me.....! thank you so much!

silverbullet24
06-21-2005, 09:00 AM
numberfield = Cint(textfield)

scragar
06-21-2005, 09:05 AM
asp let's you convert it to numbers in a lot of ways:

dim w, x, y, z

w = "54"
x = w+0 ' force it to take a litteral number to perfom a numeric action, fast
y = val(w) ' use the value function to take only numerical characters before making it an int, slow
z = Cint(w) ' convert to an int without reomving letters ect, normal.
' all of these(x, y, z) are the number 54.

w = "54a"
x = w+0 ' error!!!
y = val(w) ' fine
z = Cint(w) ' error dependant upon version and global.asa