WinForm Cancel DataGridView First Row check state

Source: Internet
Author: User

C # WinForm cancels the default selected cell of DataGridView to make it not anti-blue

Http://www.cnblogs.com/freeliver54/archive/2009/02/16/1391325.html

Datagridview1.rows[0]. Selected = false;
In the form's constructor, it doesn't look like it's going to work. First column or anti-blue
Later try to put in the form of load finally see no anti-blue
also pay attention to the DataGridView1 tabindex (you can manually modify the Tablindex attribute value of F4 dataGridView1)

if it is a separate form form, add the following method directly in the Load method:Private voidDatagridview1_load (Objectsender, EventArgs e) {dataGridView1. rows[0]. Selected =false;//uncheckor dataGridView1. ClearSelection ();//uncheckif the form forms in the parent form, the subform Form1, the parent form MainForm method One: Add DataGridView databindingcomplete Events in the Form1 formPrivate voidDgrdin_databindingcomplete (Objectsender, Datagridviewbindingcompleteeventargs e) {            if(Dgrdin.currentrow! =NULL)            {                 This. dgrdIn.CurrentRow.Selected =false; }          } 
View Code

WinForm Cancel DataGridView First Row check state

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.