19/11/2011

How to create a customized splash form? Vb.Net Code for beginners

Splash form for any application is a first windows,where the user interact with the programmer. and it is well said that first impression in the last impression. The same way a good created splash form creates a good impression about the programmer as well as program. For better understanding of these type of vb.net code or database related inquiry the book written by Mike Murach is very good book which is available on amazon with free shipping charge, I will suggest one can  refer. These are the some steps which you need to take to create a good splash form for your application



As Microsoft Visual studio provides some pre-designed splash templates for the programmers to use in their application. But a customized splash form that creates a special image about the developers  and can be used to provide the details about the developer by placing some image and bio data of the developer. In my example I have used following Visual Basic Control for creating this splash screen.

Step-1
Add a windows form in your project and place  following controls  dragging from tool box and set their properties as under




   Control                                          Property
   Timer                                        Interval - 750
   Label                                        Text  as per your necessity, as what
                                                    are the information you want to display .
 Picture box                                set image property which image or logo 
                                                    you want to display
Linklabel  (for showing web address) set Active link color, text property 
                                                  and visited link color property 
Progress bar 

Step -2

Double Click on the windows form and on windows form load event write following  Visual Basic .Net code to make the timer start.

Private Sub Frmsplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Timer1.Start()
    End Sub



Step -3 

     Create a function for  opening the windows form after closing up of splash screen
     Private Sub gotoMdi()
        Dim frm As New FrmLogin(Here after closing up of splash form, login form will open)
        Me.Hide()
        frm.ShowDialog()
        frm.Focus()


    End Sub


Step-4

Double click on the timer and write down following code:

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value += 4

        If ProgressBar1.Value <= 32 Then

            Label7.Text = "Initializing....."

        ElseIf ProgressBar1.Value <= 52 Then

            Label7.Text = "Loading components....."

        ElseIf ProgressBar1.Value <= 72 Then

            Label7.Text = "Integrating Database...."

        ElseIf ProgressBar1.Value <= 100 Then

            Label7.Text = "Please wait..."

        End If

        If ProgressBar1.Value = 100 Then

            Timer1.Dispose()

            Me.Visible = False

            Dim cur As New FrmLogin()

            cur.Show()

        End If
    End Sub
Step-5
Create another sub procedure for opening of your blog or website
    Sub VisitLink()
        ' Change the color of the link text by setting LinkVisited
        ' to True.
        LinkLabel1.LinkVisited = True
        ' Call the Process.Start method to open the default browser
        ' with a URL:
        System.Diagnostics.Process.Start("http://www.ram-a-singh.blogspot.com")
    End Sub


Step-6


Double click on linklabel and writ down following code
    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Try
            VisitLink()
        Catch ex As Exception
            ' The error message
            MessageBox.Show("Unable to open link that was clicked.")
        End Try
    End Sub


Now your splash form is ready



No comments:

Post a Comment

What & How