Results 1 to 3 of 3

Thread: [RESOLVED] Need help in class and win forms

  1. #1

    Thread Starter
    Addicted Member scsfdev's Avatar
    Join Date
    Feb 2008
    Location
    Singapore
    Posts
    224

    Resolved [RESOLVED] Need help in class and win forms

    Dear all,

    I need helps on the following of my questions. Please help me if u know.

    I want to separater my Windows application project into two parts.
    (Currently how i code is all my class, module, form will be in one single project)

    Now I want to separate them into two projects under one solution.
    That is One project will only include pure design which is win forms.
    And another project will include DB processing and background business logic.

    Can I know how to do that??
    Currently only way I can think of is pass the required win form control to the Class Project. But I don't think it is a good way. And at some point, I may need to use all controls on the form to perform a single job. So, I end up passing all controls to the Class Project.

    I want to try to google it but don't know which key words I should use to search. My vocab power is not that good in english.

    If you know how or have some samples (even a button click or display some text sample) , please kindly share me about this.

    The reason I do this is because I want to separate my business logic with design. So, later me or other developer who handle my projects can focus on business logic if something went wrong. I think this can make the projects easier to debug and study.
    And also easier to pass to end user if we update or fix the error. In so, we don't need to give the whole set up package to user. we only need to pass them the dll class.

    thanks.
    scsfdev
    I'm using VS 2005 & 2008 & 2010 with SQL Server 2005 Express.

    My hobby beside programming: http://dslrstranger.wordpress.com

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

    Re: Need help in class and win forms

    No, the design is completely the other way around. You will create one Windows Forms Application project, which will contain all your presentation logic, and one Class Library project, which will contain the rest. The WinForms project is the application, i.e. the EXE, and it will reference the DLL. That means that your forms will know about your business logic but NOT the other way around. The business logic and data access code has no idea that it's being used by forms, which is the whole point. You're supposed to be able to use that same code in any application, whether WinForms, ASP.NET, WPF, Windows Service or whatever. So, you run the app, the form invokes the appropriate business logic and that simply returns the data, with no specific knowledge of who it's returning it to.
    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

  3. #3

    Thread Starter
    Addicted Member scsfdev's Avatar
    Join Date
    Feb 2008
    Location
    Singapore
    Posts
    224

    Re: Need help in class and win forms

    Quote Originally Posted by jmcilhinney View Post
    No, the design is completely the other way around. You will create one Windows Forms Application project, which will contain all your presentation logic, and one Class Library project, which will contain the rest. The WinForms project is the application, i.e. the EXE, and it will reference the DLL. That means that your forms will know about your business logic but NOT the other way around. The business logic and data access code has no idea that it's being used by forms, which is the whole point. You're supposed to be able to use that same code in any application, whether WinForms, ASP.NET, WPF, Windows Service or whatever. So, you run the app, the form invokes the appropriate business logic and that simply returns the data, with no specific knowledge of who it's returning it to.
    Hi jmcilhinney,

    thanks for your info and reply.
    Noted!
    I'm using VS 2005 & 2008 & 2010 with SQL Server 2005 Express.

    My hobby beside programming: http://dslrstranger.wordpress.com

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