Jun 20, 2002 #1 samshiell Programmer Mar 12, 2001 26 GB Hi How can I find out programmatically if a control exists on a form? I'm writing a generic procedure to which a form is passed as a "FORM" object,and I need to know whether a tabstrip exists on the form Cheers
Hi How can I find out programmatically if a control exists on a form? I'm writing a generic procedure to which a form is passed as a "FORM" object,and I need to know whether a tabstrip exists on the form Cheers
Jun 20, 2002 #2 Norris68 IS-IT--Management Jun 19, 2002 769 GB Code: Dim C As Control For Each C In Me.Controls If TypeOf C Is TabStrip Then Debug.Print C.Name & " is a tabstrip" End If Next C Upvote 0 Downvote
Code: Dim C As Control For Each C In Me.Controls If TypeOf C Is TabStrip Then Debug.Print C.Name & " is a tabstrip" End If Next C
Jun 20, 2002 Thread starter #3 samshiell Programmer Mar 12, 2001 26 GB Cheers, Now you've pointed this out it's obvious Thanks Sam Upvote 0 Downvote
Jun 20, 2002 #4 CajunCenturion Programmer Mar 4, 2002 11,381 US You can loop thru the Controls collection that exists for every form. Something like the following Public Function CheckForTab (OnForm as Form) as Boolean Dim Cntl as Control Dim TabExists as Boolean TabExists = false For Each Cntl in OnForm.Controls If (TypeName(Cntl) = "TabStrip" Then TabExists = True End If End If CheckForTab = TabExists End Function Good Luck -------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein Upvote 0 Downvote
You can loop thru the Controls collection that exists for every form. Something like the following Public Function CheckForTab (OnForm as Form) as Boolean Dim Cntl as Control Dim TabExists as Boolean TabExists = false For Each Cntl in OnForm.Controls If (TypeName(Cntl) = "TabStrip" Then TabExists = True End If End If CheckForTab = TabExists End Function Good Luck -------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein