Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Userform Controls not Displaying

I am creating a dynamic userform to get data from the user. The data
will be held in groups of textboxes that are created within frames. I
wouldn't have any idea how many frames the user might need, so I have
made a commandbutton that will trigger this function to add more
frames below the last one and then create the textboxes and labels in
the new frame.

However, that is not happening. The code adds the frame, with the
correct name and everything, but it will not display the labels and
textboxes. I have read through a bunch of archived threads and none
address my problem. I have also tried referencing the main big frame
that holds the sub frames to add the textbox and label controls to,
but that doesn't work either. What could be the problem?

'Add a new entry frame below the last one
Set fraFrame = fraMain.Controls.Add("Forms.Frame.1", "fraEntry" &
mlFrameCount, True)
'Set the frame's size and position
With fraFrame
.Caption = "Entry Group " & mlLessonFrameCount
.SpecialEffect = fmSpecialEffectEtched
.Top = dFraTop
.Left = 6
.Width = mlENTRY_FRAME_WIDTH
.Height = mlENTRY_FRAME_HEIGHT
End With
'Where to put the first control in the frame
dCtlTop = dFraTop + 6

'Add the entry label to the new frame
Set lblControl = fraFrame.Controls.Add("Forms.Label.1",
"lblInputNames" & mlFrameCount, True)
'Set its size and position, and caption
With lblControl
.Top = dCtlTop
.Left = 6
.Width = mlLABEL_WIDTH
.Height = mlLABEL_HEIGHT
.Caption = "Input All Required Names:"
End With
'Move to the next control position
dCtlTop = dCtlTop + mlLABEL_HEIGHT

'Add the textbox to the new frame
Set txtControl = fraFrame.Controls.Add("Forms.TextBox.1",
"txtInputNames" & mlFrameCount, True)
'Set its size and position, and caption
With txtControl
.Top = dCtlTop
.Left = 6
.Width = mlTEXTBOX_WIDTH
.Height = mlTEXTBOX_HEIGHT
.MultiLine = True
.ScrollBars = fmScrollBarsVertical
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dynamic Userform Controls not Displaying

After some trial and error I found out that the controls would not
show because of the number used for the Top property value. Within
each frame, the controls inside that frame reference their Top value
from the top of the frame. Therefore there was no need to add the
height of the other frames and controls previous. Simply start at the
top of the frame in which the controls will be housed.

I hope that makes some sense.


On Apr 22, 12:06 pm, Zigs wrote:
I am creating a dynamic userform to get data from the user. The data
will be held in groups of textboxes that are created within frames. I
wouldn't have any idea how many frames the user might need, so I have
made a commandbutton that will trigger this function to add more
frames below the last one and then create the textboxes and labels in
the new frame.

However, that is not happening. The code adds the frame, with the
correct name and everything, but it will not display the labels and
textboxes. I have read through a bunch of archived threads and none
address my problem. I have also tried referencing the main big frame
that holds the sub frames to add the textbox and label controls to,
but that doesn't work either. What could be the problem?

'Add a new entry frame below the last one
Set fraFrame = fraMain.Controls.Add("Forms.Frame.1", "fraEntry" &
mlFrameCount, True)
'Set the frame's size and position
With fraFrame
.Caption = "Entry Group " & mlLessonFrameCount
.SpecialEffect = fmSpecialEffectEtched
.Top = dFraTop
.Left = 6
.Width = mlENTRY_FRAME_WIDTH
.Height = mlENTRY_FRAME_HEIGHT
End With
'Where to put the first control in the frame
dCtlTop = dFraTop + 6

'Add the entry label to the new frame
Set lblControl = fraFrame.Controls.Add("Forms.Label.1",
"lblInputNames" & mlFrameCount, True)
'Set its size and position, and caption
With lblControl
.Top = dCtlTop
.Left = 6
.Width = mlLABEL_WIDTH
.Height = mlLABEL_HEIGHT
.Caption = "Input All Required Names:"
End With
'Move to the next control position
dCtlTop = dCtlTop + mlLABEL_HEIGHT

'Add the textbox to the new frame
Set txtControl = fraFrame.Controls.Add("Forms.TextBox.1",
"txtInputNames" & mlFrameCount, True)
'Set its size and position, and caption
With txtControl
.Top = dCtlTop
.Left = 6
.Width = mlTEXTBOX_WIDTH
.Height = mlTEXTBOX_HEIGHT
.MultiLine = True
.ScrollBars = fmScrollBarsVertical
End With
.
.
.

I have thought about making the command button display another
userform on the top of this one to collect the same info.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Controls in a Dynamic UserForm Rawce Excel Programming 1 December 6th 06 07:29 AM
Dynamic Controls (CheckBox) using VBA in Excel akkurup Excel Programming 6 October 27th 05 01:01 PM
Dynamic controls Martin Walke Excel Programming 5 September 29th 04 12:15 PM
creating dynamic controls monika Excel Programming 0 April 1st 04 01:56 AM
Dynamic Label for Controls Rob Bovey Excel Programming 0 September 8th 03 06:47 PM


All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"