need help with dynamically adding a label
hi,
i've created a scrollable form with several frames & even frames within other
frames ( sub-frames?). anyway, things are fine up to this point.
all frames (and design-time frame contents (labels, textboxes) get
re-positioned correctly as the scroll bar is adjusted...
problem is trying to add labels & textboxes to the frames that were added
dynamically.
they do not show up.
any ideas w/o looking at the code?
tia...
Re: need help with dynamically adding a label
You will have set Container property for each new control:
Set Label3.Container = Frame3
Re: need help with dynamically adding a label
I would suggest that you use the SetParent API to place the textboxes and labels inside the dynamically created frame, but the problem is the labels don't have the necessary handle. You may need to create your own user control which contains your textboxes and labels and then dynamically add instances of the user control as needed.
Re: need help with dynamically adding a label
That's too much trouble Martin, isn't it ... :ehh:
Re: need help with dynamically adding a label
Quote:
Originally Posted by RhinoBull
You will have set Container property for each new control:
Set Label3.Container = Frame3
While that will move the label, I don't think you'll be able to see it once it's moved.
Re: need help with dynamically adding a label
Of course you will:
NewLabel.Visible = True
Re: need help with dynamically adding a label
Here is a quick sample:
VB Code:
Private Sub Command2_Click()
Dim lbl As Label
Dim fra As Frame
Set fra = Controls.Add("VB.Frame", "fraTemp")
fra.Move 500, 500, 6000, 3000
fra.Caption = "New Frame"
fra.ZOrder
fra.Visible = True
Set lbl = Controls.Add("VB.Label", "lblTest")
Set lbl.Container = fra
lbl.Move 300, 300
lbl.Caption = "New Label"
lbl.AutoSize = True
lbl.Visible = True
End Sub
Re: need help with dynamically adding a label
just curious, what happened to the reply from "hack"?
chu