Multiple TextBox for Input in VBScript

2019-06-11 23:04发布

问题:

Can we have multiple input text boxes in VBScript? I'm trying to create a form window using VBScript itself. I should get two values as input. Please help me.

回答1:

You have a few options that I can see.

  1. Create an HTA that contains multiple textboxes for input.
  2. Call InputBox() once for each input required.
  3. Develop your input form as COM ActiveX control that can be instantiated from VBScript. With RegFree, you don't need to install this COM control on your clients.
  4. If it makes sense to do so, use a single InputBox() but ask the user to delimit their input. Here's an example of this technique. Note the use of the default parameter to demonstrate to the user what you're looking for.

    Do
        s = InputBox("Enter the starting and ending years:", "Year Range", "2010-2014")
    Loop While Len(s) > 0 And InStr(s, "-") = 0
    
    If Len(s) = 0 Then
        ' No input or cancel clicked
    Else
        s = Split(s, "-")
    End If
    


回答2:

This is possible with HTA via VBScript.
Try this one http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
Just add the second inputbox.



回答3:

IN a form no you cannot, but you could do this in VBS, It would list a series of input box's and the input to the frst box can be used in the title and/or description of the next text box

Firstresponse = inputbox("Enter Message", "Enter your Title")
Secondresponse = inputbox("Enter Message " & Firstresponse, "Enter your Title")