Vb. NET in DataGridView controls

Source: Internet
Author: User

The display of tabular data in vb.net is commonly used in DataGridView controls, which are loved by programmers in a rich variety of data table representations.

I am doing a small system in the use of the DataGridView Control part of the properties, these functions are not easily used at the beginning of use to clarify, as the system is nearing the end, now some of the use of the review. Many of the properties of the control are interlinked, reviewing, and trying to make the road look less curved at the back.

First, how to refresh the data inside the DataGridView After the content of the search

Specific implementation:

Once the operation is complete, call Datagridview1.datasource = Data source again.

The theory is simple: to re- bind the data , that is, to check the data table again. (You may have thought about it, but the problem of running efficiency and speed has never been done, but I am sure that it is the only way to do it without optimizing control itself).

Second, cancel automatic selection

Datagridview1.currentcell = Nothing

or datagridview1.clearselection () ' This is a method, without parameters, without assigning a value, directly referencing.

Third, click any cell in the bank to select the entire row

Property SelectionMode = Fullrowselect(entire row selected)

There are other settings:cellselect(select cell [ default ]),fullcolumnselect (select the entire column), Rowheaderselect (selected at the beginning of the line) Columnheaderselect (check the top of the list).

Four, set the table header

Datagridview1.columns("Data table column name"). HeaderText = "Table header column name" ' Column name ' setting

Datagridview1.columns("Data table column name"). width = value ' column widths setting


Vb. NET in DataGridView controls

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.