Update Rectangle

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a rectangle to display how full or empty something is; the
displayed information is based on user input from over 20+ bound textbox
fields and is also based upon an option group. The only way that I have been
able to update the rectangle fill is to use an afterupdate event for each
bound textbox field used. I assume that there has to be a better way of doing
that, other than copying the same data for bound textbox field.

Can any one help me with this?
 
Have one rectangle be the "liquid" and one be the "container"... I'm
going to call them boxLiquid and boxContainer. Set the fill on
boxLiquid to a solid color. Size both rectangles on top of eachother.
Save your form.

In your form, under the afterupdate event use the following code:

Private Sub Percentage_AfterUpdate()
Dim Percentage as single
Percentage = 'You fill in the expression for a decimal percentage
here!

boxLiquid.Top = boxContainer.Top + (1 - Percentage) *
boxContainer.Height
boxLiquid.Height = Percentage * boxContainer.Height
End Sub

~J
 
I've used very similar code to do the same with a case percentage statement
to vary the colour of the *liquid* at the same time - looks good.

TonyT..
 
Did you try using the After Update event for the entire form? I'm assuming
all of the textboxes are in the same form. Otherwise, create a public
function and call it from the forms or the textboxes.
 

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

Back
Top