Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Getting names of controls


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2008, 01:34 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 130
Default Getting names of controls

Is there an easy way of getting the names of all the controls on a form at once?

GetControls() only get the names of the controls which have the form as parent, so if you as I use panels to minimize the number of forms then you will need to go through each control and see if they are parents of controls in their turn etc.

all the best / Björn
Reply With Quote
  #2 (permalink)  
Old 01-09-2008, 01:58 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,956
Default

First you can use GetControls("") to get all the controls.

Using the fact that panels controls can't be nested you can use the following code (it will add all controls on Form1 to the ArrayList named al1).
Code:
Sub Globals
    'Declare the global variables here.
    Dim crl(0),tmp(0)
End Sub

Sub App_Start
    Form1.Show
    AddArrayList("al1")
    crl() = GetControls("Form1")
    For i = 0 To ArrayLen(crl())-1
        al1.Add(crl(i))
        If ControlType(crl(i)) = "Panel" Then
            tmp() = GetControls(crl(i))
            For x = 0 To ArrayLen(tmp())-1
                al1.Add(tmp(x))
            Next
        End If
    Next
    
    'Show the controls
    For i = 0 To al1.Count-1
        Msgbox(al1.Item(i))
    Next
End Sub
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 02:05 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 130
Default

Thank you Erel. / Björn
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I manipulate objects with dynamic names ? origami Questions & Help Needed 2 05-31-2008 02:30 PM
Column names in a table pmu5757 Questions & Help Needed 2 05-07-2008 02:50 PM
COM controls lairdre Questions & Help Needed 3 02-28-2008 08:53 AM
Setting Control names as arrays. burd27 Questions & Help Needed 6 01-29-2008 10:38 AM
Controls name PepSoft Questions & Help Needed 4 12-17-2007 02:49 PM


All times are GMT. The time now is 07:45 AM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0