f the many, many new features of Visual Basic .NET, one of the most intriguing is the ease with which you can create dynamic forms. Generating a completely new and unique form on the fly now requires nothing more than instantiating a new form object and throwing the switch. In fact, instantiate a few controls, hook in some procedure to handle their event processing, and you can create an interactive application on the fly.
As you step through the process of creating this demo application, you'll learn how to craft familiar features, such as generating random numbers and using a timer, in new ways, and then learn how to implement those features in a dynamically generated form using equally dynamic controls and event handlers. Lastly, I'll describe some of the features I did not include in this demo to give you a sense of where you can go from here, and perhaps inspire some creative enhancements.
To underscore the seriousness of this new functionality and the power it can add to your mission critical applications, I've chosen a particularly dry, straightforward business tool as the demonstration: Smack The Santa. Santa is trying to stuff coals into your stocking! You have to teach him a lesson. After choosing your game options on the control screen, you'll generate a blank screen on which Santa will pop up in random places holding a stocking filled with coal. Smack him before he gets away! The more times you smack him, the higher your score. Figure 1 shows Santa as he appears on the form.
Figure 1: The Smack the Santa game form. This form doesn't exist at design-time. The control form creates it dynamically based on user input.
|