PDA

Click to See Complete Forum and Search --> : Usercontrol Help


davepuk
Aug 20th, 2002, 08:33 AM
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

GlenW
Aug 20th, 2002, 09:04 AM
Always the same number of questions and inputs?
If not you're going to need to dynamically create them.

davepuk
Aug 20th, 2002, 09:06 AM
yes always the same number of questions and outputs

GlenW
Aug 20th, 2002, 09:12 AM
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.

GlenW
Aug 20th, 2002, 09:14 AM
or have a function that returns an array of strings that are obtained from the input box

davepuk
Aug 20th, 2002, 09:27 AM
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.

GlenW
Aug 20th, 2002, 09:38 AM
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:


if ( txt1.Enabled And ( Len(txt1 > 0 ) ) Then
MsgBox "No value"
Exit Sub
if ( txt2.Enabled And ( Len(txt2 > 0 ) ) Then
MsgBox "No value"
Exit Sub
if ( txt3.Enabled And ( Len(txt3 > 0 ) ) Then
MsgBox "No value"
Exit Sub
Else
DoWhatever
EndIf