Solved

Is it possible to have a sidebar number for the rows in an MSFlexgrid

Posted on 2014-09-17
3
79 Views
Last Modified: 2014-09-18
I was wondering in vb6 if it was possible to have a sidebar on the msFlexgrid where it numbers the rows.  Simalar to the same style of a header for a column, except in this case for each row, so that a user could see the amount of rows by number.
0
Comment
Question by:al4629740
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40330547
You'll need to add a new first column but then you can do this.

Private Sub Form_Load()

Dim lngRow As Long

MyGrid.FixedCols = 1
For lngRow = 0 To MyGrid.Rows - 1
    MyGrid.TextMatrix(lngRow, 0) = lngRow + 1
Next
End Sub

Open in new window

0
 

Author Comment

by:al4629740
ID: 40330586
Then do I have to manually label them?
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40330701
If the number of rows doesn't increase then no, you can just use the code I supplied. If the number of rows increases then do this when you add a new row.

' Add the new row
MyGrid.Rows = MyGrid.Rows + 1

' Number the new row
MyGrid.TextMatrix(MyGrid.Rows - 1, 0) = MyGrid.Rows

Open in new window


In any case I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 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