|
-
Oct 17th, 2002, 11:31 PM
#1
Thread Starter
Member
Get all control on a form
IS there a quick and easy way to get all controls on a form?
-------------------------------
StupidMonkee
-
Oct 17th, 2002, 11:37 PM
#2
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 18th, 2002, 05:10 AM
#3
Addicted Member
The form.controls only returns the controls that the form is parent of, it won't return child controls on that control.
The answer is I don't know if there is an easy way(would like to know one though!) At present I think you need to create a custom collection and add each control to it. See the post on text box controls for the code, which is around here somewhere.
Wind and waves resolves all problems.
-
Oct 18th, 2002, 10:04 AM
#4
Thread Starter
Member
Originally posted by cim3
The form.controls only returns the controls that the form is parent of, it won't return child controls on that control.
The answer is I don't know if there is an easy way(would like to know one though!) At present I think you need to create a custom collection and add each control to it. See the post on text box controls for the code, which is around here somewhere.
Ok i might be naive here but im not sure which are parent/child controls. I want to get a list of all (let's say) command buttons that are on the form? Are these children? Or will form.controls work?
My inclination is that it woudl work but i'm not near my computer
-------------------------------
StupidMonkee
-
Oct 18th, 2002, 11:25 AM
#5
Fanatic Member
Why couldn't you loop through all controls on the form and examine each one and check to see if it has anything in *its* Controls collection?
-
Oct 18th, 2002, 11:38 AM
#6
If the button is on the form itself not on a tabcontrol or another control that is on the form then Me.Controls will work for you. I agree with Slow_Learner just use recursion. I guess you are going to have to change your name soon Slow_Learner
-
Oct 18th, 2002, 11:41 AM
#7
Fanatic Member
How can I take a name like Captain Wiseass when I neglect to note that all Controls have a HasChildren property?
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemwindowsformscontrolclasshaschildrentopic.htm
thanks though
-
Oct 18th, 2002, 12:38 PM
#8
Thread Starter
Member
Originally posted by Slow_Learner
Why couldn't you loop through all controls on the form and examine each one and check to see if it has anything in *its* Controls collection?
I was not talking about the technique here, i simply needed to knwo if a form.controls woudl return a list with (for example command buttons) in it. I woudl obviously loop to find the exact one i needed. the haschildren was key, thanks.
thanks though guys.
-------------------------------
StupidMonkee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|