Use a formula to populate a label from a textbox

D

damorrison

I am tryin to caption a label from this textbox with no luck

Label1.Caption = (Round(TextBox1 / 0.03125, 0) * 0.03125)


the the label has to be formated like this
# ??/??
 
D

Dave Peterson

maybe:

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "# ??/??")
 
D

damorrison

Hi Dave,
I am getting a type mismatch error

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "#
??/??")
 
D

Dave Peterson

I'm betting that what you have in textbox1 isn't a number (or doesn't look like
a number).

if isnumeric(textbox1.value) then
Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "# ??/??")
else
Label1.Caption = "not a number in textbox1"
end if
 
D

damorrison

Thanks dave,
Yes the problem was,
as soon as I hit the decimal the type mismatch error kicked in thanks
alot
 
D

damorrison

When entering into the textbox,
is it possible to enter as fractions and decimals, when I enter as
fractions it becomes a non-number
 

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