What's new

Tutorial Flashing Form using VB.Net

Status
Not open for further replies.

CodeWarrior

Addict
Joined
Feb 16, 2014
Posts
23
Reaction
16
Points
78
Age
39
This is my simple form effect it called the flashing form effect, i use this effect if i want to create
personalize message box to determine an error or window message.

Lest start:

First Open your vb.net language and create new project, name your project any name you want.
First of all we need to import some references to our project reference name is "System.Runtime.InteropServices".
On the form drag and drop a timer we need one timer to handle a flashing effect

Second double click your form and press ctrl+a and delete everything.

Third copy and paste this code to your empty form.

Code:
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("user32.dll", EntryPoint:="FlashWindow")> _
    Public Shared Function FlashingWindow(ByVal fls As Integer, ByVal bit As Integer) As Integer
    End Function
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With Timer1
            .Interval = 500
            .Enabled = True
            .Start()
        End With
    End Sub
    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        FlashingWindow(Me.Handle, 1)
    End Sub
End Class

Now your done, Press F5 and start debugging

Happy Happy Coding...

Credited to ME :)
 
Status
Not open for further replies.

Similar threads

Back
Top