Results 1 to 7 of 7

Thread: Usercontrol Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Posts
    4

    Usercontrol Help

    I want to create my own input command to uses instead of the existing one in vb. The difference is i want the form to have several questions and input boxes. Can any one give me any help on this i have read all the tutorials in vb6 and things online but no one seams to tell you how to pass information back from the usercontrol like the input command does

    Has anyone got any ideas??

    cheers

  2. #2
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    Always the same number of questions and inputs?
    If not you're going to need to dynamically create them.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Posts
    4
    yes always the same number of questions and outputs

  4. #4
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    Make the values of each input a property of the input box control.
    When you click OK on your input box they are set.
    Then you can access them from your program.

  5. #5
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    or have a function that returns an array of strings that are obtained from the input box

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Posts
    4
    i want it to work in the same way that the Input command works
    eg

    strReturn = Input("Prompt","Title","defaultValue")

    This command sets up the prompt for the question the title of the form and the default value the input box. It then returns the users input or a string set to nothing when the user clicks cancel.

    This is basically what i want to create but with the added option of passing more prompts and default values to it. Been able to see if the user has actually entered a value and if they havent then get them to enter a value.

  7. #7
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    Optional parameters will sort out how many inputs are needed.
    Set you text boxes enabled property to False.
    Just set their default value of the optional inputs to something silly and if its still the same don't enable the text box to accept that input.
    Then to check all inputs are put in:
    VB Code:
    1. if ( txt1.Enabled And ( Len(txt1 > 0 ) ) Then
    2.     MsgBox "No value"
    3.     Exit Sub
    4. if ( txt2.Enabled And ( Len(txt2 > 0 ) ) Then
    5.     MsgBox "No value"
    6.     Exit Sub
    7. if ( txt3.Enabled And ( Len(txt3 > 0 ) ) Then
    8.     MsgBox "No value"
    9.     Exit Sub
    10. Else
    11.     DoWhatever
    12. EndIf

Posting Permissions

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



Click Here to Expand Forum to Full Width