C # 's DataTable and DataGridView utility

Source: Internet
Author: User

PanPen120 on CSDN original, such as other sites reproduced please pay attention to the layout and the source:
First of all: although this period of time to contact MongoDB and some new controls in the toolbox, and some new things such as DataTable active overtime, but did not summarize to csdn up, a lot of summary, a lot of progress

Key words

DataTable

What is it?

Excel-like tables

How to use it?

            //New TableDataTable dt =NewDataTable ();//define table structureDt. Columns.Add ("Id",typeof(System.Int32));//Column list data typeDt. Columns.Add ("Name",typeof(System.String)); Dt. Columns.Add ("Age",typeof(System.String));//Add New line             for(inti =0; I <=3; i++) {DataRow dr = dt. NewRow ();//Linedr[0] = i; dr[1] ="Wang"+i; dr[2] ="5"+ i; Dt. Rows.Add (DR);//Add rows to the Datatabl grid}

How to show (How practical)

Combined with DataGridView in the Toolbox

dataGridView1.DataSource= dt   //控件.DataSource = ……(该控件可以直接绑定一个DataTable这样的表)


C # 's DataTable and DataGridView utility

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.