Convert string to integer

H

h3llz

productPrice = Val(txtProductPrice.Caption)

productPrice is dimmed as integer.
txtProductPrice.Caption is £25 and i want to get 25 out of it.
Help please :(
 
R

Rick Brandt

productPrice = Val(txtProductPrice.Caption)

productPrice is dimmed as integer.
txtProductPrice.Caption is £25 and i want to get 25 out of it. Help
please :(

productPrice = CInt(Mid(txtProductPrice.Caption,2))
 
F

fredg

productPrice = CInt(Mid(txtProductPrice.Caption,2))

Which leads to the question of why is the poster using a label to
store this gtext value, rather than a text box storing the value as an
integer (or more likely better, as Currency datatype)?
 
D

Damon Heron

I have a problem with a textbox having a caption. Is txtProductPrice a
label? Anyway,
how about:
productPrice=CCur(txtProductPrice.Caption)

Damon
 
H

h3llz

thanks

the reason a label is containing the information because when i select a
product then click get product, it will get all product information then i
have a button add ot basket, why do another query to get the product
information when its in a label? =]

Damon Heron said:
I have a problem with a textbox having a caption. Is txtProductPrice a
label? Anyway,
how about:
productPrice=CCur(txtProductPrice.Caption)

Damon
 
B

Bob Quintal

thanks

the reason a label is containing the information because when i
select a product then click get product, it will get all product
information then i have a button add ot basket, why do another
query to get the product information when its in a label? =]
The question is about why you retrieve the product information
(using the Get Product Button) in a label instead of a textbox?.
Your method involves much code, as labels have no recordsource
property. If the data were in a textbox, you would have no problem

Q
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top