![]() |
Plz help.....Problem in creating a dynamic form
I wanted to create a dynamic form as follows. 1) I ask the user to enter the required number 2) User enteres a number. for ex: 3 3) A form should genarate as Enter Employee 1 name: ".....Edit field....." Enter Employee 2 name: ".....Edit field....." Enter Employee 3 name: ".....Edit field....." The form should grow dynamically depending on the user input value. I tried this with creating a custom command bar and I succeeded creating dynamic Edit fields, but I didnt kow how to include the text "Enter Employee 1 name" before the Edit field. Please advice me how to include the text. -- shashi1515 ------------------------------------------------------------------------ shashi1515's Profile: http://www.excelforum.com/member.php...o&userid=31109 View this thread: http://www.excelforum.com/showthread...hreadid=512742 |
Plz help.....Problem in creating a dynamic form
Something like the following should do it:
Dim objLabel As Control, objTextbox As Control, i As Integer For i = 1 To iNumberToCreate Set objLabel = Me.Controls.Add("Forms.Label.1", "myLabel_" & i, True) With objLabel .Caption = "Enter Employee " & i & " name:" .Top = 20 + i * 20 ' <<< set its position on the form .Left = 10 .Width = 120 .Font.Bold = True ' or whatever you want.. End With Set objTextbox = Me.Controls.Add("Forms.Textbox.1", "myTextBox_" & i, True) With objTextbox .Top = 20 + i * 20 ' <<< set its position on the form .Left = objLabel.Left + objLabel.Width + 10 .Width = 100 End With Next shashi1515 wrote: I wanted to create a dynamic form as follows. 1) I ask the user to enter the required number 2) User enteres a number. for ex: 3 3) A form should genarate as Enter Employee 1 name: ".....Edit field....." Enter Employee 2 name: ".....Edit field....." Enter Employee 3 name: ".....Edit field....." The form should grow dynamically depending on the user input value. I tried this with creating a custom command bar and I succeeded creating dynamic Edit fields, but I didnt kow how to include the text "Enter Employee 1 name" before the Edit field. Please advice me how to include the text. -- shashi1515 ------------------------------------------------------------------------ shashi1515's Profile: http://www.excelforum.com/member.php...o&userid=31109 View this thread: http://www.excelforum.com/showthread...hreadid=512742 |
All times are GMT +1. The time now is 02:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com