September 5 2010




 
Search Blog Entries:



What is this?

Column Details
 
Auto generated code

During my current Webcast series about creating a managed Windows Mobile 5.0 line-of-business application, I show lots of demos, actually coding live for an audience, but also showing how Visual Studio 2005 can generate a lot of code for you. This is a cool feature; after all, each bit of code that is auto generated saves time entering it yourself. For instance, if you are using strongly typed data sets or SqlCeResultSets, they can be auto generated in Visual Studio by simply adding a new Data Source. If we stick to data sets, a lot of code is auto generated for you. In fact, most of the plumbing code to fill a data set from a SQL (Mobile) database is generated for you. You hardly even realize that you are dealing with a database. I think that is cool. At the same time I also think that it remains important to understand the basic structure of the generated code, if only for those situations where you get exceptions and all of sudden while debugging you end up in code that was generated for you. Understanding the structure of auto generated code will then help you pinpoint your problem faster. Understanding the structure also helps you to create similar constructions by borrowing from auto generated code. Another reason why it makes sense to study and understand auto generated code is to extend it. Thanks to partial classes this is extremely easy to do. Visual Studio takes auto generating code even one step further. Using a Data Source it is possible to auto generate a number of forms for you like Summary Views and Edit Views showing all fields for a record in individual controls. Controls on these auto generated forms make clever use of docking and anchoring to stack them on top of each other and to hide one if a particular field does not contain data. However, these auto generated forms don’t properly support using the Pocket PC’s input panel. So this is an area where you definitely want to modify auto generated code. Do you want to know how? Well, this column is simply one large teaser. Come join me for this week’s webcast on Wednesday at 11.00 AM PST and I’ll give you the answer.

 

Maarten Struys

 
Back








SpiralFX Technology Solutions
www.spiralfx.com


Do you want to learn developing a full blown Windows Mobile Application? This article and accompanying multimedia content will help you to do so. It will be extended over the upcoming weeks / months, so check back regularly.
 
Read Full Article