Let VS. Net automatically generate the interface and C # code according to the table structure

Source: Internet
Author: User

Visual Studio automatically generates query images and C # code based on the table structure

Principle:

1. Compile the VS plug-in through C #; call the VS designer; create controls and code

2. the SQL code parses the query conditions using regular expressions and generates controls.

3. Use the SQL code to obtain the queried DataTable and DataColumn. Then, create a Grid.

 

The Code is as follows:

IDesignerHost host; host of the VS designer

Form forhm = (Form) host. RootComponent; get the interface of the designer

 

You can create a widget in either of the following ways:

1. dynamically create controls (such as new Button () through C ())

= = = =  System.Drawing.Size(, =  System.Drawing.Point(, (Line + ) *  + (Line + ) *  + = TypeDescriptor.GetProperties(btn1).Find(, );

2. dynamically create controls through reflection

Control cl ==  System.Drawing.Point(= ==  System.Drawing.Size(, =  System.Drawing.Point( +  + ColV *  - cl.Size.Width - , (LineV + ) *  + LineV *  + = TypeDescriptor.GetProperties(cl).Find(, = TypeDescriptor.GetProperties(cl).Find(, + rd[].ToString());

Dynamic code creation

 ======);

Note:

Before creating a control, you must reference the DLL used by this control to the VS project.

 

Run the following command:

1. Original Design Interface of

2. Start the VS plug-in and set SQL statements

3. Set the SQL condition name

4. automatically generated interface

5. automatically generated C # code

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.