Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Loading data in progress...
 

Loading data in progress...

i want to show loding message when my form data is loading....in desktop application.....acctually there are many grids in my from, when form is load the screen is white.....instead of white screen i want to show "Data is loading"

thanks in advance
Ather...
  • Edited byAther.Abbas Friday, September 04, 2009 6:28 AMmistak
  •  
Ather.Abbas  Friday, September 04, 2009 6:27 AM
Use background worker.

Create a form and place Label,progress bar if you want. Set Style property of progressbar as marquee since value for progress bar may not be fixed.

and use this kind of code structure:

Imports System.ComponentModel
Public Class Form1
Dim WithEvents myWorker As BackgroundWorker

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myWorker = New BackgroundWorker
myWorker.RunWorkerAsync()
End Sub

Private Sub doWork(ByVal sender As Object, ByVal e As EventArgs) Handles myWorker.DoWork
showForm()
'load datagrid
End Sub
Private Sub showForm()
'Dim tempForm as New yourLoadingForm
'tempForm.ShowDialog

End Sub
End Class



Step by Step Guide to use BackgroundWorker




Thanks

â™?My Blog â™?My Flickr â™?My Facebook â™?/div>
Omie  Friday, September 04, 2009 6:50 AM
certainly it should.

you can also have more than 1 background workers if you really need them.
Or you can use Threading. Background worker is just a different class that provides some more features than threading, which can be implemented while using plain threading anyway.


Thanks

â™?My Blog â™?My Flickr â™?My Facebook â™?/div>
Omie  Saturday, September 05, 2009 6:31 AM
Use background worker.

Create a form and place Label,progress bar if you want. Set Style property of progressbar as marquee since value for progress bar may not be fixed.

and use this kind of code structure:

Imports System.ComponentModel
Public Class Form1
Dim WithEvents myWorker As BackgroundWorker

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myWorker = New BackgroundWorker
myWorker.RunWorkerAsync()
End Sub

Private Sub doWork(ByVal sender As Object, ByVal e As EventArgs) Handles myWorker.DoWork
showForm()
'load datagrid
End Sub
Private Sub showForm()
'Dim tempForm as New yourLoadingForm
'tempForm.ShowDialog

End Sub
End Class



Step by Step Guide to use BackgroundWorker




Thanks

â™?My Blog â™?My Flickr â™?My Facebook â™?/div>
Omie  Friday, September 04, 2009 6:50 AM
Acctually i have 5 userControls which contains Datagrids. The problem is i drag and drop these userControl in my form. So all the Datagrids are in my userControls. in this situation can above code help me?


thanks
Ather...
Ather.Abbas  Saturday, September 05, 2009 4:58 AM
certainly it should.

you can also have more than 1 background workers if you really need them.
Or you can use Threading. Background worker is just a different class that provides some more features than threading, which can be implemented while using plain threading anyway.


Thanks

â™?My Blog â™?My Flickr â™?My Facebook â™?/div>
Omie  Saturday, September 05, 2009 6:31 AM

You can use google to search for other answers

Custom Search

More Threads

• How to add currency format and formula to a textbox
• problem handling tab keys
• DataGridViewColumn
• Activate Context Menus with a right click
• PropertyGrid.Site
• Add controls to datagrid in VS2003
• ListView Designer Problem
• Email validation control or code for VB.Net 2005.
• Visual Studio is not adding a .resx with a form...
• Problem with designtime support for controls with collections