in

CodeSmith Community

Your Code. Your Way. Faster!

Windows Forms

Last post 07-16-2007 11:48 PM by JRich. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-08-2007 1:50 PM

    • TheEdge
    • Not Ranked
    • Joined on 05-08-2007
    • Posts 1
    • Points 35

    Windows Forms

    Sorry in advance for probably a stupid question:
    Using netTiers 2.0 I generated from a database with a couple tables and included the windows forms.

    In the solution is a windows.forms project and a subfolder called UI. This contains a datagrid and an Edit Form... nice.

    How I use these in a windows app?

     

    Filed under: ,
    • Post Points: 35
  • 07-16-2007 11:48 PM In reply to

    • JRich
    • Top 150 Contributor
    • Joined on 04-24-2007
    • Posts 26
    • Points 645

    Re: Windows Forms

    I don't know if you finally found the answer. But if not,here is how I use them and its really quite easy.

    1.  Create a User Control library project in your solution.
    2. Add a reference to the Windows.Forms dll created when you compiled your net tiers data layer.
    3. Add a new user control item to your user control project.
    4. In the code behind of this new user control, add a "using" reference to the Winforms.Forms lib (not absolutely necessary, but it makes for less typing)
    5. Notice that the user control inherits from the class UserControl. Change this inheritance to one of the Net Tiers winform edit controls. For example if your user control was Named MyUserControl, you would see the user control class declaration like this MyUserControl:UserControl. If you want this to be a CustomerEditControl, change the inhertence to this: MyUserControl:CustomerEditControl.

    You will have a user control that allows you to reposition the child controls, change their visibility, etc. Also, each FK will expose a TList property to which you can bind the List of entities required to fill that FK combo box. Anything you type into the control fields will be bound to the control's base entity. To clear the controls contents, just set the controls entitity reference to a new instantiation of that entitiy. Very cool.

    Voila...

    Filed under: ,
    • Post Points: 5
Page 1 of 1 (2 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems