MSHflexgrid控件删除选中行
相应的代码:
Private Sub some_Click()'定义变量 Dim txtSQL As String Dim MsgText As String Dim Online_mrc As ADODB.Recordset Dim mrc1 As ADODB.Recordset Dim txtStr As String Dim MsgTxt As String Dim mm As String '没有选中行时,提示用户 If myflexgrid.RowSel - 1 = 0 Then MsgBox "请选中要下机的行!", vbOKOnly + vbExclamation, "警告" Exit Sub End If '在Online_Info表中查询 txtSQL = "select * from Online_Info" Set Online_mrc = ExecuteSQL(txtSQL, MsgText) mm = Trim(myflexgrid.TextMatrix(myflexgrid.RowSel, 0)) '返回你选中行的字段对应的值 '将Online_Info表中被选中卡号的记录删除 txtStr = "delete from Online_Info where cardno='" & mm & "'" Set mrc1 = ExecuteSQL(txtStr, MsgTxt) '清除myflexgrid中的选中行 myflexgrid.RemoveItem (myflexgrid.RowSel) End Sub
CellAlignment 设置返回一个值以定义当前单元的水平和垂直方式
CellFontName 定义当前单元的字体名
CellPicture 设置/返回当前单元格的图片
CellTop,CellWidth
Cols 设置/返回网格的列数量
Row 设置/返回当前单元的垂直坐标
Rowsel 设置/返回某个范围单元的起始列
ScrollBars 设置/返回一个值表明MSHFLEXGRID控件的滚动条类型
重要方法:
Additem
Clear
RemoveItem