Two Field "InputBox"
I want a pop-up box/form to get two values from the user. I imagine a behaviour similar to the InputBox() function, but instead of returning just one value, I want it to return two values. That is, the pop up box has two fields.
I may have to create my own form. if i do that, how do i make it pop-up modally, and how do i have it return values? (or at least emulate that behaviour)
thanks!
[411 byte] By [
yonestar] at [2007-11-20 11:07:07]

# 1 Re: Two Field "InputBox"
To make it pop-up modally, just --> SomeForm,Show vbModal
and about the values, you can declare the variables in a module or declare them Public in the form and use them with the next sintax --> SomeForm.Variable1
jggtz at 2007-11-9 19:33:57 >

# 2 Re: Two Field "InputBox"
Here's a neat trick to show someting modally, be able to reference the form without using additional public variables:
-- Modal Form {myModalForm}
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode<>1 Then ' closing, but not due to Unload call
Me.Hide ' returns control back to calling form
Cancel = True ' prevents actual closing for now
End If
End Sub
Private Sub cmdBtnOK_Click() ' or whatever you use to "close" the modal form
Me.Hide
End Sub
' Note: The modal form cannot have Show commands, i.e., Me.Show causes error
-- Calling Form {myCallingForm}
' Optional if you want to set any properties/control values on modal form before it is displayed
Load myModalForm ' loads it but doesn't show it
' set those properties
' Display it modally
myModalForm.Show True, Me
' next line will not continue until modal form is closed or hidden
' >> get the values from the modal form's text boxes or other controls
' i.e., pswd = myModalForm.txtPassword
Unload myModalForm ' now ensure the form is unloaded
# 3 Re: Two Field "InputBox"
I have an app that hides 5 main forms, which call about 30 other forms, which I don't hide. Keeps things running quickly.