Helpful Information
 
 
Category: Computer Programming
How to right-click on the image to open up a menu in visual basic?

Hi! Any kind soul out there know abt visual basic? I got some problems. :)

1) In my program during run-time, I dun know how to right click on the image and open up a menu then open up a form frm the menu?

2) To draw lines and adjust the length of the line during run-time

Thanks in advance!!

For number 1:
It's actually surprisingly easy to do. Just add this code to your image(s) mousedown event



If Button = 2 Then 'If it was a right click display menu
Me.PopupMenu Me.mPopup
End If


Now, mPopup is a menu in the program. Just add it and its child elements in from the menu editor. And to get mPopup to not show up on the form in your menus, just uncheck the visible property from the menu editor.

hey thanks for your help!! :)

But i was wondering during run-time, after i right-click and the menu is display. Then, frm the menu, is it possible that i can open up a form???

:confused:

Yeah for the menu that you want to open up the form, just add the appropriate code so like:



Sub mOpenForm_Click ()
frmOtherForm.show
End Sub

yeap..Thanks! :) I have done it wif ur help!

Another prob, if it is possible to draw lines and the lines are resizeable like in the paintbrush during run-time??

I know if you put a line in during design time, you can resize it during runtime, as for creating a new one.... hmmm you got me stumped for the moment.

But to resize it during runtime, you modify it's width and height properties, and if you want to move it you can change it's left and top properties as well.

hiz..i think can forget abt tat part.. anyway, thanks :)

now got another prob is i dunno how to drag image from a treeview to a form/listview ??
:confused:

Hope anyone out there can help... Thanks a lotz ppl..;)










privacy (GDPR)