I have a EXGrid in a form and want to add button to a cell that either say "Edit" and "Remove", or Have icons for the two. Here is the code I have so far.

With grdGrade
    .BeginUpdate
        '.DataSource = objCo.DAL.Connection.Execute(sql)
        .DefaultItemHeight = 21

        .TreeColumnIndex = -1
        .MarkSearchColumn = False
        .FullRowSelect = exItemSel
        .DrawGridLines = exAllLines
        .SortOnClick = exNoSort
        .BackColorHeader = grdGrade.BackColor
        .Appearance = Flat
        .BackColorAlternate = Me.BackColor
        .SelBackColor = RGB(224, 224, 224)
        .SelForeColor = vbBlack
        .UseTabKey = True
        .Font = Me.Font

    .EndUpdate
End With

Set col = grdGrade.Columns.Add("Actions")
col.AllowDragging = False
col.Width = grdGrade.Width * 0.05
col.Editor.AddButton "Edit", , 0
col.Editor.AddButton "Remove", , 0
col.Editor.EditType = ButtonType

The buttons are there, they are just blank. Also, would it be possiable to show an icon as the button. Thanks so much for your help.

I finally got it. When loading the grid I used

 Me.grdGrade.Items.CellValue(h, "Actions") = "    Edit    "
Me.grdGrade.Items.CellHasButton(h, "Actions") = True
s = Me.grdGrade.Items.SplitCell(h, "Actions")
Me.grdGrade.Items.CellValue(0, s) = "  Remove  "
Me.grdGrade.Items.CellHasButton(0, s) = True

and it works like a charm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.