下面是实现sheet1.cs代码
private
void Sheet1_Startup(object sender, System.EventArgs e)
{
this.button1.Text =
"Save";
this.button1.Click +=
new EventHandler(button1_Click);
// TODO: 刪除這行程式碼以移除 'db_ExaminationDataSet.tb_Questions'
的預設 AutoFill。
if (this.NeedsFill("db_ExaminationDataSet"))
{
this.tb_QuestionsTableAdapter.Fill(this.db_ExaminationDataSet.tb_Questions);
}
}
private void Sheet1_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO
設計工具產生的程式碼
/// <summary>
/// 此為設計工具支援所需的方法 -
請勿使用程式碼編輯器修改這個方法的內容。
///
/// </summary>
private void InternalStartup()
{
this.button1.Click +=
new System.EventHandler(this.button1_Click);
this.Shutdown +=
new System.EventHandler(this.Sheet1_Shutdown);
this.Startup += new System.EventHandler(this.Sheet1_Startup);
}
#endregion
private void button1_Click(object sender,
EventArgs e)
{
try
{
this. tb_QuestionsTableAdapter.Update(this. db_ExaminationDataSet. tb_Questions);
}
catch (System.Data.DataException ex)
{
MessageBox.Show(ex.Message);
}
}