Add Command butons to a mshFlexgrid using vb6

Add a command button to the last column in a mshflexgrid with
the index of the row


Sub AddaRowToGrid(grd As MSHFlexGrid)
        Dim LastRow As Integer
        Dim LastColumn As Integer
        cmdViewRtf(0).Visible = False 'hide first button in header row
        With grd
        .Rows = .Rows + 1 'add a row
        LastRow = .Rows - 1
        LastColumn = Cols - 1
        'add cmdButton to last centered in row last column (cmdViewRtf) with the index of the row number
        End With
End Sub
how to write this ?
isnoend2001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Do you want a command button only on the last row? If a new row is added after that do you want the command button "moved" to the new row?
isnoend2001Author Commented:
Yes when a new record record is added the a button is added to the new row, not moved each row will have a command button with the index of the new row
Martin LissOlder than dirtCommented:
Try this demo.
Project1.zip

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

isnoend2001Author Commented:
Thanks Marty, you gave what i asked for, but i don't think  it will work like i planned
If a row is removed the button remains as they only seem to be in the grid
I think i will have to images that look like command  buttons that are actually part of the grid using the CellPicture Property
Martin LissOlder than dirtCommented:
No, no. no. That can be handled. Be back soon.
isnoend2001Author Commented:
Thanks
but i think i have found a better way, just using text
Row = LastRow
        .Col = LastColumn
        .CellFontBold = True
        .CellForeColor = vbBlue
        .CellFontUnderline = True
        .Text = "View"
all i am trying to do is use the cells click event to open a rtf with the path hidden in col 1
grid
Martin LissOlder than dirtCommented:
Well in any case here it is.
Project1a.zip
isnoend2001Author Commented:
Thanks, gonna have more questions soon i can see what i need to do, just get stumped on how to do it
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.