Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. accessing GUI

accessing GUI

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stonee74
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • S stonee74

      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

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #2

      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 <><

      S 1 Reply Last reply
      0
      • R 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 <><

        S Offline
        S Offline
        stonee74
        wrote on last edited by
        #3

        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 class public 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

        R 1 Reply Last reply
        0
        • S stonee74

          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 class public 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

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          If 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 <><

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups