Results 1 to 4 of 4

Thread: [RESOLVED] Disable everything on the form except for ONE button?

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Resolved [RESOLVED] Disable everything on the form except for ONE button?

    I have a form thats got a lot of buttons and functionality on it. I want some users to be able to view the form, but not have any of the functionality.

    What is suppose to happen?
    Everything on the form must be disabled, except for the close button.

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Disable everything on the form except for ONE button?

    What must happen? Hummmm you will need some kind of log in function that will set user rights. Once you have that you can so one of a couple (that I can think of) things.

    You move though all the controls on the form (in a for loop) and set the (1) Enabled Property to false if the control name is not the name of your close button, or (2) the Visiable property to false if the control name is not the name of your close button.

    We will need more info then what you gave to give more specific instructions then that.

    There are examples in the .Net forum that explain how to move though all the controls on a form.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Re: Disable everything on the form except for ONE button?

    The loop function you mentioned will work perfectly. I'm a little rusty on my vb code as I did php for a couple of years now. Can you please post a simple example of above Loop?

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Disable everything on the form except for ONE button?

    Very rough idea
    vb.net Code:
    1. For each ctl as Control in Me.Controls
    2.     'Something here
    3. Next

    There are complete examples and comments in this fourm if you do a search for them
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Tags for this Thread

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