我有WindowsForm的解決方案,用datagridview來顯示我從文本文件中讀取的數據。來自數據的行數很大,約爲10.000行。缺少DataGridview滾動條C#WinForm
當我從visual studio運行程序時,它似乎很好。但是,當我從Debug文件夾(.exe文件)運行它時,那麼我的datagridview出了問題。滾動條丟失。
這裏是我填的datagridview:
private void LoadInputData()
{
try
{
InputDataGridView.DataSource = null;
InputDataGridView.Refresh();
InputDataGridView.DataSource = inputDataTable;
DisableCells();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Load Input Data Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
我有一個設計來從文本文件填充inputDataTable
的功能。 DisableCells()
功能是鎖定datagridview(即設置readonly properties
爲true
)並自定義列長度。
數據仍然可以通過鼠標滾動。它是如何發生的?我該如何解決這個問題?
這裏是我的程序的預覽:link
完全一樣。 在後臺加載之前通過設置「datagridview.Datasource = NULL」進行修復,並將其設置回:「datagridview.Datasource = bindingsource」 – parfilko