Use a formula to populate a label from a textbox

  • Thread starter Thread starter damorrison
  • Start date Start date
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
# ??/??
 
maybe:

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "# ??/??")
 
Hi Dave,
I am getting a type mismatch error

Label1.Caption _
= Application.Text(Round(textbox1.value / 0.03125, 0) * 0.03125, "#
??/??")
 
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
 
Thanks dave,
Yes the problem was,
as soon as I hit the decimal the type mismatch error kicked in thanks
alot
 
When entering into the textbox,
is it possible to enter as fractions and decimals, when I enter as
fractions it becomes a non-number
 
Back
Top