Results 1 to 2 of 2

Thread: Best way to setup Class?

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Best way to setup Class?

    I have a Class that will automate processes based on a set of variables. I have a finite number of boolean variables. If True, the process will run, if False, it won't.

    If a variable is True, I'll add it's corresponding process to a Queue of processes.

    What I'd like to know, is how should I setup the processes? Should it be in the new class or form class? Should it be at class level or not?

    I was thinking I could just setup each process at Class level:
    VB.NET Code:
    1. Private p1 As New Process
    2. Private p2 As New Process
    3. Private p3 As New Process

    Then, before the process is added to the Queue, I'll assign the appropriate properties.

    Is there a better way? Or will this work just fine?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Best way to setup Class?

    It certainly shouldn't be in the form, because a form's responsibility is to display data to the user and receiving user input.

    Beyond that, it's hard to say from the info you've provided. I would generally say that you shouldn't use member variables like you've shown because there's no point creating Processes that might not be used.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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