Posts

Showing posts from March, 2010

Dynamically Loading Controls

Recently, i ran into a situation where i needed to daisy-chain several usercontrols together. The basic thought was similar to most sites "New User Data Entry" forms. You fill one out, and then you goto the next one to fill more incriminating information and then the last form you fill out, you basically sign your life away and your first born. Problem i ran into was the fact that i could not achieve this effect without a severe overload of page resources (i.e. Multi-View/View relationship) and even then it was sadly sketchy and buggy. After doing some research and some serious code management (thats what i call it :> ) I managed to achieve a relatively small method, through VB but should be easily translatable since it is small, to get the effect i needed. 1: Friend Shared Sub NextForm(ByRef par As Control, ByRef curr As Control, ByVal [new] As String) 2: 'remove current control (curr) from parent (par) 3: par.Controls.Remove(curr) 4: 'load c