vb.net - .NET: Best practice for setting properties of main form from module -
i have main form. logic of application huge. have around 100 modules in application. in modules need set properties of main form's controls.
i feel calling like
public module somestuff public sub dosomething frmmain.mycontrol.location = ... end sub end module
... dirty.
however, can not move modules main form.
is there best practice deal such situation?
edit: code works, feels ugly.
thank you!
there's number of options setting properties on form module, including:
- passing instance of form or form controls module function set
- returning values module function set on form
form argument
the form or specific form controls passed argument module sets properties. way not tied static instance of form. functions may still tightly coupled ui may make them harder unit test.
returning values
to keep separation between business logic , ui, return values need applied form via struct, class or dictionary. define method or function bind values form controls.
Comments
Post a Comment