Instantiating Windows at Runtime
Creating and displaying windows at runtime is a common task in every client application. To accomplish this you simply create an instance of a System.Windows.Window
and then invoke the Show
or ShowDialog
methods, depending if the Window
must be considered a modal dialog or not. The following Visual Basic code demonstrates how you create and show a new Window
:
In the preceding code a new Window
is generated from scratch, so this requires specifying all properties. In most cases you can instead create and show instances of existing windows that you implemented at design time; for this, in the above code you just ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.