Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have answered some questions and have gotten answers for my questions. Anywhere you can do this on one page helps tremendously..."

Geography

Where in the world do Tek-Tips members come from?
Chris77504 (IS/IT--Management)
20 Apr 12 12:18
I have the below code that shows the popup of the context menu, but when the menu item is selected nothing happens.  what am I not doing?

CODE

Private Sub Lstservers_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstServers.MouseUp

        Dim ctx As New ContextMenu

        Dim i1 As New MenuItem("&NSLookup")
        Dim i2 As New MenuItem("&Telnet")
        Dim i3 As New MenuItem("&Remove")

        AddHandler i1.Click, AddressOf ContextMenuHandler
        AddHandler i2.Click, AddressOf ContextMenuHandler
        AddHandler i3.Click, AddressOf ContextMenuHandler

        ctx.MenuItems.Add(i1)
        ctx.MenuItems.Add(i2)
        ctx.MenuItems.Add(i3)

        lstServers.ContextMenu = ctx


    End Sub

    Private Sub ContextMenuHandler(ByVal Sender As Object, ByVal e As EventArgs)
        Dim mi As MenuItem = DirectCast(sender, MenuItem)

        Select Case mi.Text.ToLower()
            Case "&NSLookup"
                sname = lstServers.Items.ToString
                TabControl1.SelectedTab = NetworkTools
                TabControl1.Focus()
                MsgBox("nslookup")


                'Your add functionality here
            Case "&Telnet"
                MsgBox("case2")
                'Your edit functionality here
            Case "&Remove"
                MsgBox("case3")
                'Your delete functionality here
        End Select
    End Sub
Bluejay07 (Programmer)
24 Apr 12 10:53
From what I can tell, the issue is with your select case.  You set the case statement to lower case, and yet each individual case is not lower case.

Select Case mi.Text.ToLower()
   Case "&NSLookup" (should this not be "&nslookup"?)

Have you followed the code execution to determe what is or is not being executed?

If at first you don't succeed, then sky diving wasn't meant for you!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close