Posted 20 November 2024, 6:11 am EST
Good day,
I am using the following code to build a ContextMenu for C1Flexgrid. Is working fine. I need to add Icons. Can you please support with a sample. in VB?
Code:
Sub BildContextMenu() Try 'Add Context menu: Dim menu As New ContextMenuStrip() Dim t As ToolStripItem = menu.Items.Add("New") AddHandler t.Click, AddressOf menuItem1_Click t = menu.Items.Add("Update") AddHandler t.Click, AddressOf menuItem2_Click t = menu.Items.Add("Delete") AddHandler t.Click, AddressOf menuItem3_Click C1FlexGrid.ContextMenuStrip = menu Catch ex As Exception MsgBox("Error 'BildContextMenu' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical) End Try End Sub Private Sub menuItem1_Click(sender As Object, e As EventArgs) Try MsgBox("Item 1 clicked / ID = " & GetValue(C1FlexGrid(ClickRow, 1))) Catch ex As Exception MsgBox("Error 'menuItem1_Click' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical) End Try End Sub Private Sub menuItem2_Click(sender As Object, e As EventArgs) Try MsgBox("Item 2 clicked / ID = " & GetValue(C1FlexGrid(ClickRow, 1))) Catch ex As Exception MsgBox("Error 'menuItem2_Click' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical) End Try End Sub Private Sub menuItem3_Click(sender As Object, e As EventArgs) Try MsgBox("Item 3 clicked / ID = " & GetValue(C1FlexGrid(ClickRow, 1))) Catch ex As Exception MsgBox("Error 'menuItem3_Click' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical) End Try End Sub
Thanks
Said