accessing GUI
-
Hi there, I want to split up my app into a GUI part and the some "working" parts behind. Which means to access certain parts of the GUI (e.g. Listbox) and fill it with data generated in nother methods of other classes. For me as a newbie i could maybe imagine some ways to do it, but what's the professional approach on that one? Are there any tutorials around related to that? thanks a lot in advance, stonee
-
Hi there, I want to split up my app into a GUI part and the some "working" parts behind. Which means to access certain parts of the GUI (e.g. Listbox) and fill it with data generated in nother methods of other classes. For me as a newbie i could maybe imagine some ways to do it, but what's the professional approach on that one? Are there any tutorials around related to that? thanks a lot in advance, stonee
Yes, there are many avenues for breaking the GUI up and having business and/or data logic. In .NET it is so easy to use libraries (DLLs) that makes a long term (old fuddy duddy) like me, have to rethink my old logic. Now that working with modules are so easy, it calls out for a greater object oriented design. It is what COM was supposed to be with all the hassle. You can find many different articles right here on CP or go to msdn.microsoft.com and search for "n-tier". There are many things on their about breaking an application up into modules (tiers). By using a modular approch to your application, you can replace you business logic without having to redistribute you GUI, or switch database sources without having to modify your business logic or GUI. To even add more of a reason, with .NET, remoting and web services offer even more bang for seperation. If it is modular from the start you might remote out your business logic and data logic to reside out on a server or distribute it amongst different machines. Really easy to do with .NET. Flexible! Of course, all this only matters if you application is something more than a simple one screen program to display some data. It really all depends on the type of application. Rocky Moore <><
-
Yes, there are many avenues for breaking the GUI up and having business and/or data logic. In .NET it is so easy to use libraries (DLLs) that makes a long term (old fuddy duddy) like me, have to rethink my old logic. Now that working with modules are so easy, it calls out for a greater object oriented design. It is what COM was supposed to be with all the hassle. You can find many different articles right here on CP or go to msdn.microsoft.com and search for "n-tier". There are many things on their about breaking an application up into modules (tiers). By using a modular approch to your application, you can replace you business logic without having to redistribute you GUI, or switch database sources without having to modify your business logic or GUI. To even add more of a reason, with .NET, remoting and web services offer even more bang for seperation. If it is modular from the start you might remote out your business logic and data logic to reside out on a server or distribute it amongst different machines. Really easy to do with .NET. Flexible! Of course, all this only matters if you application is something more than a simple one screen program to display some data. It really all depends on the type of application. Rocky Moore <><
Ok, thanks for that. But just for my understanding; I have a method in class a, providing a certain information.
internal void OnAnswer(object myobject) { myobject.message }
and my main classpublic class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.ListBox listBox1; }
what's the best approach to add myobject.message to my listbox? and what's the easiest one? thanks again, stonee -
Ok, thanks for that. But just for my understanding; I have a method in class a, providing a certain information.
internal void OnAnswer(object myobject) { myobject.message }
and my main classpublic class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.ListBox listBox1; }
what's the best approach to add myobject.message to my listbox? and what's the easiest one? thanks again, stoneeIf you your main class knows about your class taht you have the 'OnAnswer' in, you could use a delegate to notify your main class to feed the listbox. You could also pass the listbox to the other class and have it fill it for you. Personally, I would rather have the delegate trigger an event that the main class picks up. You can pass the message in the delegate to the main class. Rocky Moore <><