Draw Box or Line programmatically

mithani

Registered User.
Local time
Today, 22:20
Joined
May 11, 2007
Messages
291
Hi All,

Is it possible to draw box or line programmatically.

thanks

mithani
 
You'll need to put one on the form, or report, first and then you can set it's visible property to No so it can't be seen. Then, you can use it using the MoveSize method and then set it visible.

You might be able to completely dynamically create one, but since it is considered a design change you would need to open the form/report in design mode programatically and then add it and then display the form/report back to regular view. But, if it already exists, there is no such restriction.
 
Thanks Bob,

Would you kindly give me any example to use dynamically. What exactly I am doing. I have program to estimate the aluminium and glass. User has to enter the number of panels(box) and height and width. I can control the size of each box but don't know how to copy the same box if required more than one panel(box).

Thanks

mithani
 
Are you trying to visually show what they are entering?
 
Yes, please see the attached JPG. Whatever number of panel entered by user, should show.

thank

mithani
 

Attachments

  • box.JPG
    box.JPG
    21.1 KB · Views: 444
Hi mithani,

Not an easy task, but here's a start from Help.

Code:
CreateControl, CreateReportControl Methods Example

The following example first creates a new form based on an Orders table. It then uses the CreateControl method to create a text box control and an attached label control on the form.

Sub NewControls()
    Dim frm As Form
    Dim ctlLabel As Control, ctlText As Control
    Dim intDataX As Integer, intDataY As Integer
    Dim intLabelX As Integer, intLabelY As Integer

    ' Create new form with Orders table as its record source.
    Set frm = CreateForm
    frm.RecordSource = "Orders"
    ' Set positioning values for new controls.
    intLabelX = 100
    intLabelY = 100
    intDataX = 1000
    intDataY = 100
    ' Create unbound default-size text box in detail section.
    Set ctlText = CreateControl(frm.Name, acTextBox, , "", "", _
        intDataX, intDataY)
    ' Create child label control for text box.
    Set ctlLabel = CreateControl(frm.Name, acLabel, , _
         ctlText.Name, "NewLabel", intLabelX, intLabelY)
    ' Restore form.
    DoCmd.Restore
End Sub

Any idea Bob
mithani
 
BOb

You might be able to completely dynamically create one, but since it is considered a design change you would need to open the form/report in design mode programatically and then add it and then display the form/report back to regular view. But, if it already exists, there is no such restriction.

Any example?

Thanks

mithani
 

Users who are viewing this thread

Back
Top Bottom