Support Forums
Quick Question! - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: Quick Question! (/showthread.php?tid=13627)



Quick Question! - pers2981 - 11-10-2010

Okay so i want this to happen

If button1.enable = true then
button2.enable = true

(codes prob wrong but thats not the issue)

Where would i put that so its always checking?


RE: Quick Question! - Xzotic - 11-10-2010

Its pretty simple. Just put the codes in each button.

When you click on Button1 make it
button2.enabled = true

Or vise versa. You can do that with anything, just put it inside the buttons.

Or you could probably make it work on form load.


Edit: Sorry I didnt understand it at first. But now I get what your saying.
I would put this in the form load.

if button1.enabled = true then
button2.enabled = true

Thats the right code.

If you need more help you can add me on MSN


RE: Quick Question! - thanasis2028 - 11-11-2010

If you want this to be checked at each second you can use a timer and add that code to the time's tick event. You can also set a different interval so that it checks every 10 millisecs, for example.


RE: Quick Question! - JMK940 - 11-14-2010

Put a timer on your form and set the interval to 5000 thats every 5 seconds.

In the timer code put your code from above.


RE: Quick Question! - KoBE - 11-14-2010

Don't use a timer. If you have have it changing throughout your program just use this
Code:
Private Sub Button1_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.EnabledChanged
        If Button1.Enabled = True Then
            Button2.Enabled = True
        Else
            Button2.Enabled = False
        End If
End Sub