4 Replies - 398 Views - Last Post: 13 July 2012 - 04:11 PM Rate Topic: -----

#1 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

VB6 Menus

Posted 09 July 2012 - 05:43 AM

Good Day !

Is it possible to list down Form Menu name in ListView?
Example:

- Assuming that the word listed below are MDIForm Menus.
File (mnuFile)
..... Open (mnuOpen)
..... New (mnuNew)
..... Save (mnuSave)
Insert (mnuInsert)
..... Picture(mnuPicture)
..... Shapes (mnuShapes)


- Items in ListView:
mnuFile
mnuOpen
mnuNew
mnuSave
mnuInsert
mnuPicture
mnuShapes

Thanks !

Is This A Good Question/Topic? 0
  • +

Replies To: VB6 Menus

#2 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

Re: VB6 Menus

Posted 10 July 2012 - 03:04 AM

I already get it !
xD


BTW, heres my code ..
    Dim mc As Variant
    For Each mc In MDIForm1.Controls
        If TypeName(mc) = "Menu" Then
            If mc.Caption <> "-" Then
                With ListView1
                .ColumnHeaders.Clear
                                    .ColumnHeaders.Add(, , "Menu Caption").Width = 3000
                                    .ColumnHeaders.Add(, , "Menu Name").Width = 2000
                    With .listitems
                        With .Add(, , mc.Caption)
                                            .ListSubItems.Add , , mc.Name
                        End With
                    End With
                End With
            End If
        End If
    Next


This post has been edited by BobRodes: 10 July 2012 - 11:36 AM

Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 547
  • View blog
  • Posts: 2,904
  • Joined: 19-May 09

Re: VB6 Menus

Posted 10 July 2012 - 11:38 AM

Nicely done! :)

One little minor improvement. Variants are large variables, because they have to include information about what type of variable they are. It's a little more efficient to declare your mc variable as a Control type, so:
Dim mc as Control
You probably didn't know you could do that. :)

By the way, I edited your post to include code tags.
Was This Post Helpful? 1
  • +
  • -

#4 deverauxxi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 19-July 11

Re: VB6 Menus

Posted 12 July 2012 - 07:13 PM

Thank you BobRodes for replying to all my posts.
You always giving me a lot of information to improve my programming skills.
:bigsmile:
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 547
  • View blog
  • Posts: 2,904
  • Joined: 19-May 09

Re: VB6 Menus

Posted 13 July 2012 - 04:11 PM

You are most welcome.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1