Hi,
This one is troubling. I am trying to add controls dynamically, based on user entry and on information from a database. I want to add a frame(1 or more, depends on user entry) and then inside the frame have one or more command buttons and text boxes. I can create the frame and the command button, but I can't figure out how to set the frame as the container for the command button.
Here is the code I have so far:
Dim cmdButton As VB.CommandButton
Dim frameFrame As VB.Frame
Set frameFrame = Form1.Controls.Add("vb.frame", "frame1"
With frameFrame
.Visible = True
.Top = 120
.Left = 120
.Height = 1500
.Width = 1500
End With
Set cmdButton = Form1.Controls.Add VB.commandbutton", "cmdCommand"
Set cmdButton.Container = frameFrame 'This is where the problem seems to be.
cmdButton.Visible = True
cmdButton.Left = 120
cmdButton.Top = 120
cmdButton.Height = 400
cmdButton.Width = 600
Any suggestions.
Thanks,
This one is troubling. I am trying to add controls dynamically, based on user entry and on information from a database. I want to add a frame(1 or more, depends on user entry) and then inside the frame have one or more command buttons and text boxes. I can create the frame and the command button, but I can't figure out how to set the frame as the container for the command button.
Here is the code I have so far:
Dim cmdButton As VB.CommandButton
Dim frameFrame As VB.Frame
Set frameFrame = Form1.Controls.Add("vb.frame", "frame1"
With frameFrame
.Visible = True
.Top = 120
.Left = 120
.Height = 1500
.Width = 1500
End With
Set cmdButton = Form1.Controls.Add VB.commandbutton", "cmdCommand"
Set cmdButton.Container = frameFrame 'This is where the problem seems to be.
cmdButton.Visible = True
cmdButton.Left = 120
cmdButton.Top = 120
cmdButton.Height = 400
cmdButton.Width = 600
Any suggestions.
Thanks,