CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2000
    Location
    Ohio
    Posts
    31

    Enable Menu items

    I have a form that has Textbox a CommandButton and a ListView and a pull down menu, in the pull down menu I have (Add,Modify, Delete and Exit), I am trying to have the menu items (Modify and Delete) to be enabled and disenable according to the fact there is an item selected in the ListView. Can someone tell which is best place to put the function that enable and disable the menu item?


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Enable Menu items

    Supposing you have a menu like this

    mnuFile
    --mnuOpen

    Where mnuFile is the top-level menu. If you want mnuOpen to be enabled / disabled according to the listview selected item, then ...


    private Sub mnuFile_Click()
    Dim li as ListItem
    '
    set li = ListView1.SelectedItem
    '
    mnuOpen.Enabled = Not (li is nothing)
    '
    End Sub




    - should do the trick

    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured