Option Explicit On
Option Strict On
Public Class FormFader
Private _i As Double = 0.0
Private _MinOpacity As Integer = 0
Private _MaxOpacity As Integer = 1
Public Sub FadeIn(ByVal TargetForm As Form, ByVal FadeStep As Double)
If TargetForm.Visible = False Then
TargetForm.Opacity = 0
TargetForm.Visible = True
End If
For _i = 0 To _MaxOpacity Step FadeStep
TargetForm.Opacity = _i
TargetForm.Refresh()
Next
End Sub
Public Sub FadeOut(ByVal TargetForm As Form, ByVal FadeStep As Double)
If TargetForm.Visible = False Then
Return
End If
For _i = 1 To _MinOpacity Step -FadeStep
TargetForm.Opacity = _i
TargetForm.Refresh()
Next
End Sub
End Class
The type for variable '_i' will not be inferred because it is bound to a field in an enclosing scope. Either change the name of '_i', or use the fully qualified name (for example, 'Me._i' or 'MyBase._i')