Solved

MSFlexGrid - vb6 deletion of rows

Posted on 1998-12-01
1
255 Views
Last Modified: 2012-06-27
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
Comment
Question by:MaryD
1 Comment
 
LVL 2

Accepted Solution

by:
dabellei earned 50 total points
ID: 1447637
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question