Results 1 to 5 of 5

Thread: [RESOLVED] ForEach confusing me. Shows Captions instead of Names?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    211

    [RESOLVED] ForEach confusing me. Shows Captions instead of Names?

    Hi,

    I'm trying my luck with For Each control array logic and I'm confused as to why VB is returning the caption for the control, instead of the name(index)

    Here is my code:

    Code:
    Dim daCtrl As Control
    
    For Each daCtrl In frmMain.Controls
        If TypeOf daCtrl Is ComboBox Then
            msgbox daCtrl.Container
        end if
    Next
    now the Container for the first 5 controls is a frame with the name of "Frame_Orders". The caption for that frame is "<Orders>"

    The msgbox shows "<Orders>" But I am not asking for the Container.Caption value, I want the actual object name. It would seem almost obvious that VB would return the object name but apparently not. How do I get it to return the name instead of the caption?
    Last edited by DssTrainer; Feb 7th, 2007 at 04:35 PM.

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