简体   繁体   中英

C# Datagridview refresh

This is all of the code regarding my DataGridView. Is there anything that could cause Refresh() not to work?

    this.usersDataGridView.AllowUserToAddRows = false;
    this.usersDataGridView.AllowUserToDeleteRows = false;
    this.usersDataGridView.AutoGenerateColumns = false;
    this.usersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
    this.usersDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
    this.iDDataGridViewTextBoxColumn,
    this.uSERNAMEDataGridViewTextBoxColumn,
    this.nAMEDataGridViewTextBoxColumn,
    this.sURNAMEDataGridViewTextBoxColumn,
    this.pASSWORDDataGridViewTextBoxColumn,
    this.pERMISSIONDataGridViewTextBoxColumn});
    this.usersDataGridView.DataSource = this.usersBindingSource1;
    this.usersDataGridView.Location = new System.Drawing.Point(9, 9);
    this.usersDataGridView.Name = "usersDataGridView";
    this.usersDataGridView.ReadOnly = true;
    this.usersDataGridView.Size = new System.Drawing.Size(488, 291);
    this.usersDataGridView.TabIndex = 0;
    this.usersDataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.usersdataGridView_RowClick);

I apologize in advance if this question has been answered, but I could not find answer that could help me.

try this:

dataGridView1.DataSource = typeof(DataSet); 
dataGridView1.DataSource = this.usersBindingSource1;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM