怎么
删除Dataset里的被Datagrid指定的行 Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object,ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick If e.Button Is bhExit Then Me.Close() End If If e.Button Is bhAdd Then Dim newForm As New useradd newForm.Show() End If If e.Button Is bhDel Then DataGrid1.Select(DataGrid1.CurrentRowIndex) If (Message
Box.Show( 您确定要
删除这一行吗?,
提示,Message
BoxButtons.YesNo,Message
BoxIcon.Question) = DialogResult.Yes) Then ???????? End If End If End Sub __________________________________________________________________________ 怎么没人帮忙...... __________________________________________________________________________ 郁闷 __________________________________________________________________________ 取到选中行数据的主键或唯一标志,操作
数据库即可 __________________________________________________________________________ 你的一行数据至少有一个字段或者多个字段的组合能标识这行是唯一的吧。 然后用这种组合去DataSet里查找,然后
删除这一行,然后再重新绑定DataGrid __________________________________________________________________________ 我只能想象,能给段
代码么??? __________________________________________________________________________ tCust.Rows(dgResult.CurrentCell.RowNumber).Delete() 得到行号 __________________________________________________________________________ Dim bm As BindingManagerBase Private Sub Form10_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load dapsw.Fill(DataSet21) DataGrid1.SetDataBinding(DataSet21,psw ) bm = Me.BindingContext(DataSet21,psw ) End Sub Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Dim dgrDelete = DialogResult Try dgrDelete = Message
Box.Show( 是否要
删除记录?,Message
BoxButtons.YesNo) If dgrDelete = DialogResult.Yes Then With bm .RemoveAt(.Position) End With Message
Box.Show(
删除成功,
提示 ) dapsw.Update(DataSet21) DataSet21.AcceptChanges() End If Catch err As Exception Message
Box.Show(err.Message) End Try End sub 我的给你参考下 __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263679.html