[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.
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.
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?
Re: Disable everything on the form except for ONE button?
Very rough idea
vb.net Code:
For each ctl as Control in Me.Controls
'Something here
Next
There are complete examples and comments in this fourm if you do a search for them