這個例子可以給你一個想法,通過您的問題工作
- 創建兩個函數或方法,其中一個顯示的所有記錄,顯示非刪除的行其他。
- 根據條件調用函數或方法並設置圖像。
在單擊按鈕事件中編寫代碼。
Dim GetNonDeletedDataTable As DataTable = GetNonDeletedDataTable()
Dim GetFullDataTable As DataTable = GetFullDataTable()
'
' Fill in the data grid When Imange shows ShowFullRecImg.bmp.
if(GetNonDeletedDataTable.Rows.Count<>0 And this.toolStripButton1.Image = Bitmap.FromFile("c:\\ShowFullRecImg.bmp"))
DataGridView1.DataSource = GetFullDataTable()
this.toolStripButton1.Image = Bitmap.FromFile("c:\\ShowNonDeletedRecImg.bmp")
End if
'
' Fill in the data grid When Imange shows ShowNonDeletedRecImg.bmp.
if(GetFullDataTable.Rows.Count<>0 And this.toolStripButton1.Image = Bitmap.FromFile("c:\\ShowNonDeletedRecImg.bmp"))
DataGridView1.DataSource = GetFullDataTable()
this.toolStripButton1.Image = Bitmap.FromFile("c:\\ShowFullRecImg.bmp")
End if
第一函數作爲GetFullDataTable()
Private Function GetFullDataTable() As DataTable
'
' This Function needs to build the data table which contains both deleted and non deleted rows.
Return New DataTable()
End Function
第二功能爲GetNonDeletedDataTable()
Private Function GetNonDeletedDataTable() As DataTable
'
' This Function needs to build the data table which contains non deleted rows.
Return New DataTable()
End Function
@Zoya Y.G.這個例子對你有幫助嗎?如果是的話請接受並註冊。 –