如何实现mshflexgrid控件的行上下移动
如何实现人员顺序上下任意调整?
[解决办法]
MSHFlexGrid1.RowPosition(2) = 3
这样就可以把第二行挪到第三行去
[解决办法]
10 楼的方法很好。
Option Explicit
Private Sub Form_Load()
With MSFlexGrid1
.FixedRows = 0
.Rows = 0
.AddItem "A" & vbTab & 0
.AddItem "B" & vbTab & 1
.AddItem "C" & vbTab & 2
.AddItem "D" & vbTab & 3
End With
End Sub
Private Sub MSFlexGrid1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim n As Long
With MSFlexGrid1
n = .Row
If KeyCode = vbKeyNumpad8 And n > 0 Then
.RowPosition(n) = n - 1
.Row = n - 1
ElseIf KeyCode = vbKeyNumpad2 And n < .Rows - 1 Then
.RowPosition(n) = n + 1
.Row = n + 1
End If
End With
End Sub