Geeks With Blogs
Silverlighting... Ramblings on Silverlight and occasionally WPF

While this blog is primarily about Silverlight, ocassionally this blog will also contain posts about other .NET technologies. Including Windows Forms. Did you just gasp? Wait. There are still many developers in various corners of the world working with Windows Forms even today. So I thought to cater to them for a change and share any little useful information that I come across on Windows Forms.

Tips:

1. When using the BackgroundWorker component, if you get an exception from a code statement similar to the below:

      backgroundworker1.CancelAsync();


    you must set the WorkerSupportsCancellation property of backgroundworker1 to true before the above statement.

 

2. When creating a Windows Forms application with a large number of controls at run time through the Load event handler of the form, there can be a long delay before the form gets loaded. To avoid this, call the SuspendLayout method of the form before adding all the controls and ResumeLayout method of the form after adding all the controls.

 

3.Before you call GetChanges() or AcceptChanges() on a DataSet object, check to see if it actually contains any changes by using the HasChanges() method of the DataSet.

 

4. Use the SplitContainer control to create divided Windows forms. This control creates a subsection of the form where a Splitter divides the Split-Container into two SplitterPanel controls, each of which behaves similar to a Panel control.

Posted on Saturday, July 23, 2011 8:12 PM | Back to top


Comments on this post: Windows Forms Tips

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mamta | Powered by: GeeksWithBlogs.net