简体   繁体   English

C#Datagridview刷新

[英]C# Datagridview refresh

This is all of the code regarding my DataGridView. 这是关于我的DataGridView的所有代码。 Is there anything that could cause Refresh() not to work? 有什么可能导致Refresh()无法工作吗?

    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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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