Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

MSFlexGrid - vb6 deletion of rows

I have used msflexgrid.clear, also a routine to back up the rows within the grid to get to row 1. I have also used
msflexgrid.row = 1, but I always seem to get blank lines, sometimes several, before I start writing within the grid again. Is there magic to get back to row 1 in order to start writing rows again.

This is the routine I have used, it clears the grid, but I get blank lines before I start adding rows again to the grid.

Private Sub cmdRouteAbandon_Click()
Dim K As Integer
On Error GoTo ErrorSection
  'clear grid
   gClrCnt = gClrCnt + 1
   MSFlexGridNewRoute.Row = gClrCnt 'last row
   For K = 1 To gClrCnt
            MSFlexGridNewRoute.Col = 0
            MSFlexGridNewRoute.Text = " "
            MSFlexGridNewRoute.Col = 1
            MSFlexGridNewRoute.Text = " "
            MSFlexGridNewRoute.Col = 2
            MSFlexGridNewRoute.Text = " "
            MSFlexGridNewRoute.Col = 3
            MSFlexGridNewRoute.Text = " "
    If gClrCnt > K Then
        MSFlexGridNewRoute.Row = MSFlexGridNewRoute.Row - 1
    End If
    Next K
    'MSFlexGridNewRoute.Rows =
    SegRteFrom = cboMasterFromZone.
    cboRouteTo.SetFocus
    gClrCnt = 0
    Exit Sub
ErrorSection:
    MsgBox "Error:" & Err & " " & Err.Description
    'will call error program from here errors.vbp
    Exit Sub
End Sub
0
MaryD
Asked:
MaryD
1 Solution
 
dabelleiCommented:
One thing i do to clear a grid is

' this will clear the grid and reset number of rows
' set the gridrows to the number you want
' it's fast and it's working
msflexgrid.rows=1

msflexgrid.rows=  number_of_rows_you_want



' if you're in a database

do while not data.eof
   ' add a row to the grid
   msflexgrid.rows=msflexgrid.rows+1
   ' position to the last row of the grid
   msflexgrid.row=msflexgrid.rows-1
   'fill in the grid as you wish
   data.movenext
loop




0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now