How can I optimize the loading of data into my datasets?

How can I optimize the loading of data into my datasets?

How can I optimize the loading of data into my datasets? I have developed an application that takes quite a time to load whenever I click on a menu that calls a form. I do get my data in the Load event of the form. Can this be optimized so as to load the forms faster? Thank you.

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchWinDevelopment.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWinDevelopment.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

If you've got a lot of data, there isn't much you can do. While it could open a whole can of worms, what you might want to look at is doing your data retrieval in a background thread so as the form load occurs and the data retrieval occur at the same time. Of course, this could mean a lot of problems with synchronization between the threads and the UI.

Another approach may be to only ask for the amount of data that will be displayed in the datagrid view so you'll only have to get a subset of the data. As the user moves through the datagrid, you'll have to request the data you haven't yet retrieved. This means you'll have to keep track of what data you've retrieved and what you haven't so you don't get the same data multiple times.

This was first published in November 2003