Current location: Hot Scripts Forums » Programming Languages » Visual Basic » list objects in container?


list objects in container?

Reply
  #1 (permalink)  
Old 02-08-04, 08:05 AM
Jimboat Jimboat is offline
New Member
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
list objects in container?

How can i (programatically) get a list of all the controls in a given container? I have several containers (picturebox), each with many controls inside. How can i create the list of all the controls in each picturebox? Or how can I determine which container a given control is in?
Reply With Quote
  #2 (permalink)  
Old 02-18-04, 07:31 AM
ritchieroo ritchieroo is offline
New Member
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
All controls placed on a form are accesible via the Form's "Controls" collection, and each control has a "Container" property which returns a reference to its container

Code:
Dim ctl as Control

For Each ctl In Me.Controls
    Debug.Print ctl.Name; ctl.Container.Name
Loop
To test for controls in a specific container, I'd use the ObjPtr function

Code:
Dim ctl as Control

For Each ctl In Me.Controls
    If ObjPtr(SomePictureBox) = ObjPtr(ctl.Container) Then
        Debug.Print ctl.Name; ctl.Container.Name
    End If
Loop
Reply With Quote
Reply

Bookmarks


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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formmail Script Fix - Cant display multiple list selections.. zamen PHP 3 05-02-04 09:59 AM
dyanamic list box based on a variable solovaz JavaScript 0 01-16-04 03:02 AM
Newsletter and mailing list Hoolines Script Requests 2 10-18-03 07:00 PM
help finding a mail list server mikestreb PHP 0 09-16-03 11:35 PM


All times are GMT -5. The time now is 01:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.