VB.NET - left click context menustrip - Asked By jenn on 13-May-10 01:13 AM

good morning all !

wondering if anyone knows how to make the context menustrip work on a left click instead of having to right click.
I have a button that will show the menu strip when you right click, but I would like it to show on a left click.

thanks :)
Sakshi a replied to jenn on 13-May-10 01:20 AM
this will show the context menu on left click,

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
ContextMenuStrip1.Show(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y)
ContextMenuStrip1.Visible = True
End Sub
Anoop S replied to jenn on 13-May-10 02:49 AM
you can achieve this by  Set the NFI's ContextMenuStrip property.

private void notifyIcon1_MouseUp(object sender, MouseEventArgs e) {
 if (e.Button == MouseButtons.Left) {
        MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
        mi.Invoke(notifyIcon1, null);

jenn replied to Sakshi a on 13-May-10 03:52 PM
ahhh okay :)

I will try that and see how it works! I think in the past couple days I did try something similar but it just didnt seem to do it for me!

thank you

I will give this a whirl! :)
jenn replied to Anoop S on 13-May-10 03:54 PM
well I guess that this method might work as well..but it seems kind of complicated to me LOL
that could be that I am really new at this though!

what  difference is there between this method and the method that was in the other post? are there any options that this method offers that the other one doesnt?

jenn replied to Sakshi a on 13-May-10 04:18 PM
ahhhhhhhh :)
this works like a charm! Thank yaaaaaa! :)