Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list command buttons used in vb application

Status
Not open for further replies.

richardtsa

Programmer
Nov 10, 2002
20
0
0
ZA
Is there a method to list all the command buttons used in an application that was written in vb
 
You have the complete source code of the application?

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
.FRM files are text files that will open in Notepad. Do a search for 'VB.CommandButton' through all the .FRM files and the command button name is immediately after that text.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 

For listing the controls at runtime, you need to load each form in the project. Since we dont know which all forms are there, you will need to write project specific code to call each form, and use the controls collection and forms collection to get the names of each control in the form.

For example,

Code:
Dim frm As Form
Dim ctl As Control

    Load Form1
    Load Form2
      [COLOR=green]'(Load all your forms here)[/color]

    For Each frm In Forms
        For Each ctl In frm.Controls
            If TypeOf ctl Is CommandButton Then
                MsgBox frm.Name & vbCrLf & ctl.Name
            End If
        Next ctl
    Next frm

Let me know if this works for you.

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top