後的位置,這是我的代碼:如何保存重裝的DataGridView
private void getData(string selectCommand)
{
string connectionString = @"Server=localhost;User=SYSDBA;Password=masterkey;Database=C:\data\test.fdb";
dataAdapter = new FbDataAdapter(selectCommand, connectionString);
DataTable data = new DataTable();
dataAdapter.Fill(data);
bindingSource.DataSource = data;
}
private void button1_Click(object sender, EventArgs e)
{
getData(dataAdapter.SelectCommand.CommandText);
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = bindingSource;
getData("SELECT * FROM cities");
}
在Button1的Click重裝數據後,小區選擇跳到上第一列和滾動條復位。 如何保存DataGridView的位置?
此Page.IsPostback屬性僅對ASP.NET應用程序有效。我們在這裏談論WinForms。 – 2010-03-14 15:10:40