Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

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 ?
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

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?
Avatar of isnoend2001

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
No, no. no. That can be handled. Be back soon.
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
User generated image
Well in any case here it is.
Project1a.zip
Thanks, gonna have more questions soon i can see what i need to do, just get stumped on how to do it