Unanswered: Add Edit Delete Options on right click in MSFlexGrid Control VB6
Hi: Can any one please tell me how to enable a right click option in MSFlexGrid Control. I mean when user right click in any grid row, it ask option Add, Edit, Delete and when user click on any one of them another form will be open and load the values from that row into new form.
Hi, you can do it this way:
Create a form with MSFlexGrid1 control (several rows and columns).
Prepare your menu - activate the form and use Tools - Menu Editor. Define the items of the menu. The main item called MojeMenu is not visible, subitems are called Add, Edit, Delete in my case.
Here is the code. The Edit_Click() sub is not defined but you can do like other subs.
Dim Rada As Integer
Private Sub Add_Click()
MSFlexGrid1.AddItem "", Rada + 1
Private Sub Delete_Click()
Private Sub Form_Load()
Dim I As Integer
MSFlexGrid1.Col = 0
For I = 0 To MSFlexGrid1.Rows - 1
MSFlexGrid1.Row = I
MSFlexGrid1.Text = I
Private Sub MSFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then ' Check if right mouse button was clicked.
Rada = Int((y) / (MSFlexGrid1.RowHeight(1)))
PopupMenu MojeMenu ' Display the menu as a pop-up menu.
Last edited by loquin; 02-05-07 at 17:16.
Reason: add [code] [/code] tags for readability.