x = textbox1.value (somethings wrong)

  • Thread starter Thread starter CAA
  • Start date Start date
C

CAA

I'm at a loss here. What have i done wrong?

put in the amount in a textbox and the image sizes, but if i want t
add something to the size like 2 other variables then something goe
wrong

Hgt = textbox1.value
Image1.Height = Hgt - TT - TV

Should i be coverting the value to a long type?
Thanks for looking
CA
 
It certainly won't hurt.

What is in TT & TV?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Still not right?

I run the form and enter, say 900 in the text box. When the value of T
& TV = 0 (just text positions if they exist) all is ok. Then when TT i
not 0 all go's to pot.
Says cannot set height, so i look at the value of HGT and it is 0, wh
would it be 0?

using
Hgt = Val(textbox1.value)

I have declared Hgt, TT and TV as Long types.
should i be decalring another type to hold the result of Hgt - TT
TV?

It seems a simple thing, why is it thrashing my head!?

Thanks for looking
CA
 
Carlos,

That doesn't surprise me because if the textbox is a number, even though
textbox returns a string it can ad correctly.

You didn't answer my question about what was in TT and TV. If the total of
TT and Tv exceeds the textbox value then you will get an error. You should
trap the error with

Hgt = Val(TextBox1.Value)
If Hgt > (TT + TV) Then
Image1.Height = Hgt - (TT + TV)
Else
MsgBox "Invalid height for image"
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks Bob,
I had done the error checking in an erlier piece of code by setting Hg
to 100 as a minimum as TT + VT could only be 90, however your commen
made me think more about what i'd done and basically i'm a plonker
again..
I had put this before an End If statement, so it was not even take
into account. Oh, the humiliation

Thanks for Alleviating the few brain Cells i have left, they really d
appreciate it & are going to celebrate in a few hours by playing
little game of Russian Vodka roulette in your honour.

CA
 
CAA,

Glad to help. I'll have a Tequila to share it with you!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top