Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which shows advanced options relative to the application I'm writing. I have two other forms which may need to call this form up

How can I set the 'advanced options' form so that it can be called up these two forms (and exposing the controls on the two forms as well)
How do I know at runtime which form made the call
How can I reference controls on the calling form? I may need to change text boxes or other properties of controls based on the options the user chose

Hope this makes some sort of sense
Thanks
Mar
 
Mark said:
I have a form which shows advanced options relative to the
application I'm writing. I have two other forms which may need to
call this form up.

How can I set the 'advanced options' form so that it can be called up
these two forms (and exposing the controls on the two forms as well)?
How do I know at runtime which form made the call? How can I
reference controls on the calling form? I may need to change text
boxes or other properties of controls based on the options the user
chose.

Don't do this. Suggestion: Use the 'advanced options' Form only to
manipulate data like an object containing the options. You can pass the
Options object from one Form to the options Form. The Options class should
implement IClonable so you are able to modify a clone of the object and to
have a cancel button. When the Options Form returns, it can either return
the new Options object or the modified original object. If you immediatelly
want to reflect changes to the Options object in the calling form, you could
add "XYChanged" events to the Options object, handled by the calling form
immediatelly reflecting the changes.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
That suggestion sounds like the best way to go. How then do I return the Options object back to the calling form, programmaticly speaking?
 
Mark said:
That suggestion sounds like the best way to go. How then do I return
the Options object back to the calling form, programmaticly speaking?


private m_Options as options

public shadows function ShowDialog( _
byval Options as options) _
as dialogresult

m_options = options.clone
'... fill controls with object properties here...

showdialog = mybase.showdialog
if showdialog = dialogresult.ok then
options.copycontent(m_options)
end if

end function

Call:
dim OptionsForm as new optionsform

if optionsform.showdialog(options) = ok then
'... reflect changes
end if
 
Back
Top