Results 1 to 2 of 2

Thread: Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2004
    Location
    New York City
    Posts
    69

    Help

    Hi guys. I would like to get some suggestions about the following:

    I am developing a solution and it has too much code already. I would like to separate it by sections in different modules to make it easier to troubleshoot or search through the code easier. The problem is that I dont know how to refference controls and variables unless i am in the module within the same form (by using me.xx) Can anyone tell me how would I reference to controls from a module or another form?
    Thanks
    None for now

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Help

    Sounds like you're a prime candidate to delve into the world of OO (object oriented) design.

    Let me just throw out this statement before going somewhere better:
    In general, controls should only be dealt with in the form class that owns them.

    Look into classes to solve your problems. A class holds a chunk of related data, and all the functions that work with this data. Once you have a class, you can make an instance of it, and you will be back with the familiar SomeClass.SomeFunction() calling scheme (by the way, Me is just shorthand for 'this class').

    Of course, this is not easy to start into, but the whole idea of classes arose as an attempt to tame the exact problem you are talking about. The intention was to encapsulate the code into discreet chunks doing discreet things so that larger projects were more manageable. When you have everything in classes, you are effectively saying "this object does this task", so you are creating a design that is set up more as a case of "you handle this part, and you handle that part, etc."

    Ok, that's a pretty weak description, but it is a whole different way of laying out code. One that you have worked with, and one that offers many organizational advantages, but one that takes a bit more thought up front, and a new way of thinking about the process.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width