By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

A form that returns a value

P: n/a
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()
Apr 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

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]

Apr 5 '06 #2

P: n/a
Tom Shelton wrote:
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
Apr 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.