Article ID: 241126 - Last Review: January 11, 2001 - Revision: 1.0

INFO: Dynamically Add UserControls That Require Run-Time Licenses

This article was previously published under Q241126
Expand all | Collapse all

SUMMARY

When a UserControl contains one or more controls that require run-time licenses, the UserControl implicitly becomes a licensed control (requires run-time license). As a result, when you use the Controls.Add method to add the UserControl dynamically, you must precede it by a call to the Licenses.Add method and provide the license key for the call.

MORE INFORMATION

If you create a UserControl named, for example, MyProject.MyUserControl, that contains one or more controls that require a run-time license, MyProject.MyUserControl acquires a run-time license implicitly. Therefore, if you use the Controls.Add method to add MyProject.MyUserControl dynamically, or call Licenses.Add "MyProject.MyUserControl" without providing the license key, you get the following error message:
Run-time error '429': You do not have an appropriate license to use this functionality.
To make this work, you must obtain MyProject.MyUserControl's license key on the development computer with the following code:
Debug.Print Licenses.Add ("MyProject.MyUserControl")
				
Then, in the client code, you can use the following code to dynamically add MyProject.MyUserControl:
Licenses.Add "MyProject.MyUserControl", "License Key"<BR/>
Form1.Controls.Add "MyProject.MyUserControl", "ControlName"
				

REFERENCES

For additional information how to add controls dynamically, click the article number below to view the article in the Microsoft Knowledge Base:
190670  (http://support.microsoft.com/kb/190670/EN-US/ ) HOWTO: Dynamically Add Controls to a Form with Visual Basic 6.0

APPLIES TO
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbinfo kblicensing kbctrl KB241126
 

Article Translations