C # winform operations on the datagridview

Source: Internet
Author: User

Set field name
Set field value
Set cell to indicate Error icon
Set current cell
Obtains the content of the current cell.
Retrieve the column Index of the current cell
Obtains the row Index of the current cell.
Next line
Up
Cancel DataGridView1 as read-only
Set DataGridView1 to read-only
Set the cells in the entire column of Column 2nd of DataGridView1 to read-only and change color.
Set the full row of cells in the 3rd row of the DataGridView1 to read-only and change color.
Set [0, 0] cells of DataGridView1 to read-only and change color
Set the cells in the entire column of Column 2nd of DataGridView1 to read-only and change color.
Set the full row of cells in the 3rd row of the DataGridView1 to read-only and change color.
Set [0, 0] cells of DataGridView1 to read-only and change color
You cannot manually Add a new row to DataGridView1
Set the user to manually Add a new line to the DataGridView1
Disable the row deletion operation of datagridview1.
The row deletion operation of the DataGridView1 object is allowed.
Hide the first column of DataGridView1
Hide the first row of DataGridView1
Display the first column of DataGridView1
Display the first line of DataGridView1
Column header hiding
Hide row Header
Column header display
Line header display
Delete a column named "Column1"
Delete column 4
Delete row 3
Do not change the column width of all columns of DataGridView1.
Disable the user to change the Row Height of all rows of the DataGridView1
Allows you to change the column width of all columns of DataGridView1
Allows the user to change the Row Height of all rows of the DataGridView1
Disable the user to change the column width of the first column of DataGridView1
Disable the user to change the row width of the first column of DataGridView1
The minimum column width of the first column is set to 100.
The minimum Row Height of the first row is set to 50.
Disable the user from changing the height of the column header
Disable the user from changing the width of the line Header
Set automatic adjustment of column width including Header and all cells
Set automatic adjustment of the Row Height including the Header and all cells
Automatic Adjustment in the first column
The width of the specified column header can be adjusted automatically.
Set the width of the line header to be automatically adjusted
Automatically adjust the width of all columns of DataGridView1.
Automatically adjust the column width of the third column of DataGridView1.
Automatically adjust the height of all rows of the DataGridView1.
Let the Row Height of the first row of DataGridView1 be adjusted automatically.
Automatic column header Height Adjustment
Automatic line header Width Adjustment
The left two columns of DataGridView1 are fixed
The top 3 rows of the DataGridView1 are fixed.
Change the content of the first column header of DataGridView1
Change the content of the first line of the DataGridView1
Changes the content of the upper left header of the DataGridView1 object.
Change the content of the second column header of DataGridView1
Determine whether to select the current cell
Obtain the clipboard content and separate it by line
Whether it is a column header
Split data by Tab
Line header settings
Cell content settings
Row index + 1 of the DataGridView
Set the ToolTip content of a cell
Sets the ToolTip content of cells in the column header.
Sets the ToolTip content of the row header cell.
ContextMenuStrip settings of the DataGridView
Set ContextMenuStrip of a column
ContextMenuStrip setting of the column header
ContextMenuStrip setting of a row
Cell ContextMenuStrip settings
ContextMenuStrip setting of the column header
ContextMenuStrip setting of the row Header
If the cell value is an integer
When the "Column1" column is of the Bool type and is True, set its ContextMenuStrip
If the cell is in the Column1 column
Change the cell value to uppercase
The Format and Format are applied.
When the cell column is "Column2"
Set the cell value to uppercase
Resolution complete
Set the default value of a cell
When the cell value is a negative integer, the Error icon is displayed.
Setting of row error messages
If the verification succeeds, the error message indicating clearing the row is displayed.
 

Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Text;
Using System. Windows. Forms;



Using System. Data. OracleClient;


Using System. IO;
Using System. Data. OleDb;

Namespace TestMouseMove
{
Public partial class Form3: Form
{
Public Form3 ()
{
InitializeComponent ();
DgvLoad ();
}

Public void dgvLoad ()
{
This. Maid [0]. HeaderCell. Value = "name ";
This. Maid [1]. HeaderCell. Value = "Field 2 ";
This. Maid [2]. HeaderCell. Value = "Field 3 ";
This. Maid [3]. HeaderCell. Value = "field 4 ";
T

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.