Re: i love reflection:)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



So you're not really using DataBinding, but just updating the appropriate
Property when a control changes?
And how does it work when one of the property's of your business object
changes, and the Form must be updated?

Pieter

"guy" <guy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B7DA1FBA-D044-463A-A03F-6DCFF2D1B877@xxxxxxxxxxxxxxxx
hi,
cant give you the code as its in a number of methods in a couple of
classes
but:-
in the base form...
load event get a hashtable of all the controls you might want to bind to
add an event handler that binds to the leave event or similar (1 handler
for
all the controls) that handler can then use reflection to update the
appropriate property in the business object.
declare a business object of base type
write a display method that uses reflection to display all the properies
in
the business object, call this from the event raised in the business
object
(below)
ensure that when you name controls in the form they correspond to property
names in the business class, with + txt, lbl or whatever

in the base business class...
raie an event when any property you are interested in changes value

thats pretty much it (written at 3am so i may have missed a few bits!)

drop me an email to guy.omitthis@xxxxxxxxxxx and i will send you the code
when i have it fully tidied up

cheers

guy


.



Relevant Pages

  • Re: proper programming? (events)
    ... The event is going to occur no matter what, so adding that logic to choose which handler is invoked is not a clear separation of UI logic and business logic unless another class handled the delegation for the UI component, but that would be extra work with no apparent value. ... There is very little that can be shifted to another object because so much involves an interaction between a UI object and a business object. ... UI controls need to react to the events raised by the use of other UI controls. ... This is when I use a separate object. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DataTable/DataSet in Business Object Class
    ... Business Layer project. ... To bind the product class's properties to controls, ... I am implementing Business object, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Business Object and User Interfaces
    ... The business object just create a Client and then it's ... So yes, practically you will have duplicated code, or in other word, two ... different codes that do the same like "Show the client info to the user". ... > to populate your controls' data? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UI and BL Interface
    ... I am designing a 3 tier application. ... I have seen examples that the UI creates and new business object ... layers, requiring a communications layer like a web service. ... business objects from its controls' events, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Just uninstalled Delphi 2005 Enterprise
    ... >> Document-View pattern into a UI. ... controls is that they ARE typed. ... TStringGrid and the like that I've seen where data from a business object is ... > practice still have a whole lot of business rules implemented in the UI: ...
    (borland.public.delphi.non-technical)