Link to home
Start Free TrialLog in
Avatar of Corey Scheich
Corey ScheichFlag for United States of America

asked on

Re-Usable Property values?

I swear I read about this at some point in time but haven't had a great use for it until now and I can't seem to find anything on it anymore.

I want to re-use a SaveFileDialog and an OpenFileDialog.  The initialization properties for both classes are nearly identical.  Is there a way to create a class or a structure or other that could be used to fill the properties?

for example
Public Struct FileDialog
    Filter = "XML Files (*.xml)|*.xml"
    DefaultExt = "XML"
    InitialDirectory = "c:\"
end Struct

Dim SaveFileDialog1 as new SaveFileDialog
Dim OpenFileDialog1 as new OpenFileDialog

SaveFileDialog.Properties = FileDialog 'I just made that up =)

OpenFileDialog.Properties = FileDialog 'The ability to re-use for different objects and to have multiple pre-sets for a single object

TIA
Corey2
Avatar of jrscherer
jrscherer
Flag of United States of America image

You can not create your own derived class from OpenFileDialog or SaveFileDialog since both are declared NonInheritable.
Otherwise it would have been easy to include a structure into the inherited class.

Jack.net
ASKER CERTIFIED SOLUTION
Avatar of newyuppie
newyuppie
Flag of Ecuador image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Corey Scheich

ASKER

Idle_Mind do you have any examples for using reflection in this manner?  The examples here are likely simpler but I would like to know incase it fits this or another situation better.  Thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial