Home All Groups Group Topic Archive Search About

A form that returns a value

Author
5 Apr 2006 2:50 PM
Dustin Davis
I'm creating a wizard and I've got multiple paths a user can go through
and multiple forms depending on the options they choose on each form.

Is it possible to have a form return a value, much like a function?

For example:

Dim Step1 As New frmStep1
FileType = Step1.ShowDialog

.... or even passing values by reference:

Dim Step1 As New frmStep1(FileType, FileName)
Step1.ShowDialog()

Author
5 Apr 2006 3:12 PM
Tom Shelton
Dustin Davis wrote:
Show quoteHide quote
> I'm creating a wizard and I've got multiple paths a user can go through
> and multiple forms depending on the options they choose on each form.
>
> Is it possible to have a form return a value, much like a function?
>
> For example:
>
> Dim Step1 As New frmStep1
> FileType = Step1.ShowDialog
>
> ... or even passing values by reference:
>
> Dim Step1 As New frmStep1(FileType, FileName)
> Step1.ShowDialog()

Just add them as properties to the form.  Then you can reference them
like this:

Dim Step1 As New frmStep1
Step1.ShowDialog
FileType = Step1.FileType
FileName = Step1.FileName

HTH

--
Tom Shelton [MVP]
Author
5 Apr 2006 4:09 PM
Dustin Davis
Tom Shelton wrote:
Show quoteHide quote
> Dustin Davis wrote:
>> I'm creating a wizard and I've got multiple paths a user can go through
>> and multiple forms depending on the options they choose on each form.
>>
>> Is it possible to have a form return a value, much like a function?
>>
>> For example:
>>
>> Dim Step1 As New frmStep1
>> FileType = Step1.ShowDialog
>>
>> ... or even passing values by reference:
>>
>> Dim Step1 As New frmStep1(FileType, FileName)
>> Step1.ShowDialog()
>
> Just add them as properties to the form.  Then you can reference them
> like this:
>
> Dim Step1 As New frmStep1
> Step1.ShowDialog
> FileType = Step1.FileType
> FileName = Step1.FileName
>
> HTH
>
> --
> Tom Shelton [MVP]
>

Oh, wow, so simple :blush: - Thanks!

Dustin