Solved

MSFlexGrid - vb6 deletion of rows

Posted on 1998-12-01
1
251 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now