form.activeform.opacity

Raddict

Active member
Joined
May 19, 2005
Messages
28
Location
Rotterdam (Holland)
Programming Experience
3-5
I tried to make a form that would become semitransparant when moved.
But I couldn't get it to work, when I put the command in Move or LocationChanged it results in an error.

VB.NET:
Expand Collapse Copy
Private Sub Form1_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LocationChanged
		Form1.ActiveForm.Opacity = 0.5
	End Sub

	Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Move
		Form1.ActiveForm.Opacity = 0.5
	End Sub

when I use the command behind the MouseDown it works.
 
No active form yet

The error happened cause there's no active form yet

form1.activeform !!!

you can do one of two

change the form1.activeform with me

so your code will be
"Me.Opacity = 0.5"

or

'this to avoid the 1st error on load
dim flag as integer = 0 'on the form level

if flag <> 0 then
form1.activeform.Opacity = 0.5
else
flag = 1
end if



 
Back
Top