connectseekers.com

Monday, 22 September 2014

Splash Screen With Please Wait OR Loading Message in C#.net in Windows Application

9/22/2014 - By Pranav Singh 1

This article will show you how you can display the please wait or loading message on button click in windows application using C#.net. This will help to display loading message while interacting with DB.


So for this article first we will create a new windows application and add two form one form for please wait message or for loading message.




Now add one more form with button.



Now add the below code on button click event of the form.

C#.Net Code
using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            PleaseWait objPleaseWait = new PleaseWait();
            objPleaseWait.Show();
            Application.DoEvents();

            /*Remove the function and
             put your function which will interact with DB */
            DBOperation();

            objPleaseWait.Close();
        }
        public void DBOperation()
        {
            for (int i = 0; i < 2; i++)
            {
                System.Threading.Thread.Sleep(1000);

            }

        }
    }
}

VB.Net Code
Imports System.Drawing
Imports System.Windows.Forms

Namespace WindowsFormsApplication1
    Partial Public Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
            Dim objPleaseWait As New PleaseWait()
            objPleaseWait.Show()
            Application.DoEvents()

            'Remove the function and
            '             put your function which will interact with DB

            DBOperation()

            objPleaseWait.Close()
        End Sub
        Public Sub DBOperation()
            For i As Integer = 0 To 1

                System.Threading.Thread.Sleep(1000)
            Next

        End Sub
    End Class
End Namespace

In above code simply I have open the please wait form and then application.doevents for processing the data. After completing the process just close the form.

Now run the application and check the output.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

1 comment:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top