CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Menu Items

  1. #1
    Join Date
    Apr 2001
    Location
    canada
    Posts
    12

    Menu Items

    I am trying to creating on my menu edit the menu item print with subitems which will let the user
    pick what he wants to print

    This is what i have so far
    &Print
    ...Data1
    ...Data2
    ...Data3
    However when i click ok onthe menu editor, it is asking me for an index. So where do i put an index number Do i start at 0 or 1 and where do I start from.
    Please help.

    Thanks
    Samantha


  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Menu Items

    maybe you put the same name for two menu items.

    Name the menu items as

    mnuPData1
    mnuPData2
    mnuPData3

    Then it will not ask you for the index.


  3. #3
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Menu Items

    If you are trying to dynamically create menu items, then you must create one at design time (mnuPrintData) and then assign the Index property a value of 0. Then, at run time you can create news like this:

    dim iNextItem as Integer

    iNextItem = UBound(mnuPrintData) + 1

    Load mnuPrintData(iNextItem)

    mnuPrintData(iNextItem).Caption = "print this item"




    now, in your Private Sub mnuPrintData_Click() event - you have to check for the value of the Index paramenter that's passed in a do some action accordingly. Like this:

    private Sub mnuPrintData(Index as integer)

    Select Case Index
    Case 1 'they want to print the first item
    Call PrintStuff(Index) 'whatever you want to do here...
    Case 2 'they want the secod one
    'whatever...
    Case 3
    ....
    End Select

    End Sub




    hope this makes sense and/or helps,

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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