-
I have two forms - form1 and form2. Form1 has a command button. When clicked, form2
will minimize to the taskbar, or else it's Window state will be normal - it depends on its current position. The colour of the command button will become white or grey, also depending on the window state of form2.
i.e:
Private Sub Command1_Click()
If Form2.WindowState = vbNormal Then
Form2.WindowState = vbMinimized
Form1.Command1.BackColor = &H8000000F
Else
If Form2.WindowState = vbMinimized Then
Form2.WindowState = vbNormal
Form1.Command1.BackColor = vbWhite
End If
End If
End Sub
The above works fine - form2 minimizes/ normalizes and the command button turns grey/
white, respectively. The problem is when someone clicks on form2 when it has been
minimized to the Taskbar - I mean if they click the icon on the taskbar (to where the form has been minimized) instead of the command button. Form2 goes to its correct window state, but the command button on Form1 stays grey, when it is supposed to go white.
Is there any way I can have it so that the command button will turn grey when form2 is
minimized, and white when it is maximized - regardless of whether they click the
command button or not?
Any help would be much appreciated.
-
you'll need to make code in form2's activate event
------------------
DiGiTaIErRoR