Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Greying-out contents of frames

Greying-out contents of frames

Greying-out contents of frames

When you disable a frame by setting its enable property to false, the contents of the frame are disabled but not greyed out. Is there a way to grey them out without writing code to individually enable/disable every control in the frame?

RE: Greying-out contents of frames

As far as I know, you have to disable each control individually.  However, that can be done quite easily by a separate subroutine which accepts a parent control id, and then loops through the controls collection, and processing only those controls whose parent is the passed in frame.  Specific syntax will depend on what language you're using.

RE: Greying-out contents of frames

Thanks CajunCenturion. That sounds like a great idea. I'll give it a try.

RE: Greying-out contents of frames

One thing that you need to be careful of.  If you have a frame inside of another frame, and you disable to outer frame, you will have a multi-level issue to deal with as the controls in the inner frame will have the inner frame as it's container, and not the outer frame.

As long as you don't have container objects inside of the outer frame, you don't need to worry about it.

RE: Greying-out contents of frames

Here's the code I tried which works OK for most controls but it fails when I put a SysInfo control on the form. Why?

Dim objCtl As Object
For Each objCtl In Controls
    If objCtl.Container.Name = MyFrame Then
       objCtl.Enabled = False
    End If

RE: Greying-out contents of frames

The SysInfo control has is a special purpose control and may not have an enabled property.

There are two ways to deal with this.  One way is to take the SysInfo control outside of the frame so that its containiner is the form.  Second, you could use the on error resume next statement, to ignore the error.

RE: Greying-out contents of frames

The error occurs if the SysInfo control is inside or outside the frame. I added this line to avoid it.

If TypeOf objCtl Is SysInfo Then

Everything works fine now. Thanks for your help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close