Re: Help doing this with MSHFlexgrid???
- From: "Rick Rothstein \(MVP - VB\)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Mon, 2 Oct 2006 22:53:02 -0400
Not sure about that left button delete but... use the mouse to select a
few cells and hit the delete key.
'===========
Option Explicit
............<<snip>>............
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim iRow As Integer
Dim iCol As Integer
Dim iRowStep As Integer
Dim iColStep As Integer
If KeyCode = vbKeyDelete Then
With MSFlexGrid1
If .RowSel < .Row Then
iRowStep = -1
Else
iRowStep = 1
End If
If .ColSel < .Col Then
iColStep = -1
Else
iColStep = 1
End If
For iRow = .Row To .RowSel Step iRowStep
For iCol = .Col To .ColSel Step iColStep
.TextMatrix(iRow, iCol) = ""
Next
Next
'clear the selection
.RowSel = .Row
.ColSel = .Col
End With
End If
End Sub
'===========
I can shorten up that KeyDown code a little bit for you...
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim OriginalFillStyle As Long
If KeyCode = vbKeyDelete Then
With MSFlexGrid1
OriginalFillStyle = .FillStyle
.FillStyle = flexFillRepeat
.Text = ""
.FillStyle = OriginalFillStyle
'clear the selection
.Row = .Row
End With
End If
End Sub
Rick
.
- References:
- Help doing this with MSHFlexgrid???
- From: Rick Bond
- Re: Help doing this with MSHFlexgrid???
- From: Ken Halter
- Help doing this with MSHFlexgrid???
- Prev by Date: Re: recordcount per date ? could you do that?
- Next by Date: Re: Visual Basic/Access Database - I'm a Little Stuck....
- Previous by thread: Re: Help doing this with MSHFlexgrid???
- Next by thread: Re: Msgbox (VB 6.0) becomes modeless after a few clicks on the form
- Index(es):