0
我已經添加了一個刪除按鈕來從DataGridView中刪除數據,它立即刪除,但我想問你是否想刪除它之前刪除。如何將此功能添加到此按鈕?在刪除之前詢問vb express 2008
這是我到目前爲止的代碼:
Private Sub Table_RKMBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.Table_RKMBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.RKM_System_dataDataSet)
End Sub
Private Sub Management_Window_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'RKM_System_dataDataSet.Table_RKM' table. You can move, or remove it, as needed.
Me.Table_RKMTableAdapter.Fill(Me.RKM_System_dataDataSet.Table_RKM)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Table_RKMBindingSource.AddNew()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Table_RKMBindingSource.EndEdit()
Table_RKMTableAdapter.Update(Me.RKM_System_dataDataSet.Table_RKM)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Table_RKMBindingSource.RemoveCurrent()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Table_RKMBindingSource.EndEdit()
Search_Window.Show()
Table_RKMTableAdapter.Update(Me.RKM_System_dataDataSet.Table_RKM)
Me.Close()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.WindowState = FormWindowState.Minimized
End Sub
Private Sub Table_RKMDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Table_RKMDataGridView.CellContentClick
End Sub
謝謝。
哪個按鈕進行刪除?我會建議你在將來爲你的控件分配有意義的名字。 –
你沒有添加任何東西到'Button'。所有的代碼都是表單的一部分。 Button的'Click'事件處理程序是表單的一部分,而不是'Button'的一部分。很顯然,它是RemoveCurrent調用,它會刪除當前行,所以顯然你需要在該行之前提示用戶並使用If語句來確定用戶所說的內容。你真的不知道如何問用戶一個問題嗎?這是非常基本的,你可以通過網絡搜索輕鬆找到。 – jmcilhinney
對不起,我正在使用Button3 – user3699611