+ Reply to Thread
Results 1 to 2 of 2

Plz help.....Problem in creating a dynamic form

  1. #1
    Registered User
    Join Date
    02-02-2006
    Posts
    12

    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.

  2. #2
    Andrew Taylor
    Guest

    Re: 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



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1