The Page C # appears in sequence (DataTable and DataGridView improve)

Source: Internet
Author: User

The Page C # appears in sequence (DataTable and DataGridView improve)

:

Enter information in the textBox Control and click Add

Appears

Continue:

Code (the csdn code insertion function is useless because the inserted code addition, deletion, and modification cannot be selected, which is especially troublesome. The following code may look messy ):

// Select GrooveDataTable = new DataTable () as the creation beam form; // create nine columns of GrooveDataTable. columns. add ("name", typeof (System. string); GrooveDataTable. columns. add ("sex", typeof (System. string); GrooveDataTable. columns. add ("age", typeof (System. string); // Insert the data in MongoDB to the columns corresponding to this row (Here we store the data in MongoDB, retrieve bson before, and then foreach) foreach (BsonDocument result in resultList) {// create a row of DataRow dr = GrooveDataTable. newRow (); // row information dr [0] = Your Data dr [1] = Your Data dr [2] = Your Data // Add the above row to GrooveDataTable in the DataTable. rows. add (dr); // bind to the sorce dataGridView1.DataSource = GrooveDataTable; writable tables

 

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.