dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Iterating thru controls in a form

  1. #1
    rkbnair Guest

    Iterating thru controls in a form



    I have an ADO databound form with some textbox, maskedbox and datacombo controls
    on it. Due to some reason, the DataCombo control is not identified. All other
    controls are coming thru the loop.

    For Each MyObject In pForm ' Iterate through each element.
    If TypeName(MyObject) = "DataCombo" Then
    print myobject.datafield
    End If
    If TypeName(MyObject) = "MaskEdBox" Then
    print myobject.datafield
    End If
    next

    Anybody have any suggestions please.



  2. #2
    Bob O`Bob Guest

    Re: Iterating thru controls in a form

    rkbnair wrote:
    >
    > I have an ADO databound form with some textbox, maskedbox and datacombo controls
    > on it. Due to some reason, the DataCombo control is not identified. All other
    > controls are coming thru the loop.
    >
    > For Each MyObject In pForm ' Iterate through each element.
    > If TypeName(MyObject) = "DataCombo" Then
    > print myobject.datafield
    > End If
    > If TypeName(MyObject) = "MaskEdBox" Then
    > print myobject.datafield
    > End If
    > next
    >
    > Anybody have any suggestions please.



    Make absolutely certain that it's really a DataCombo?

    For Each MyObject In pForm
    Debug.Print TypeName(MyObject)
    Next


    Might there be a typo in your comparison string?
    The case of "myobject" proves to me that you didn't actually
    just cut & paste the code above.


    Bob O`Bob
    --
    I see the writing on the wall, and even without my reading glasses,
    can discern that many of the four-letter-words start with "J".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center