home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_AddaWindowsFormsControlatRunTime_snippe_142696_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-09-17  |  3KB  |  98 lines

  1. <?xml version="1.0"?>
  2. <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.   <CodeSnippet Format="1.0.0">
  4.     <Header>
  5.       <Title>Add a Windows Forms Control at Run Time</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Creates a new instance of a Windows forms TextBox control at run time.</Description>
  8.       <Shortcut>formAdd</Shortcut>
  9.     </Header>
  10.     <Snippet>
  11.       <References>
  12.         <Reference>
  13.           <Assembly>System.Drawing.dll</Assembly>
  14.         </Reference>
  15.         <Reference>
  16.           <Assembly>System.Windows.Forms.dll</Assembly>
  17.         </Reference>
  18.         <Reference>
  19.           <Assembly>System.dll</Assembly>
  20.         </Reference>
  21.       </References>
  22.       <Imports>
  23.         <Import>
  24.           <Namespace>Microsoft.VisualBasic</Namespace>
  25.         </Import>
  26.         <Import>
  27.           <Namespace>System</Namespace>
  28.         </Import>
  29.         <Import>
  30.           <Namespace>System.Drawing</Namespace>
  31.         </Import>
  32.         <Import>
  33.           <Namespace>System.Windows.Forms</Namespace>
  34.         </Import>
  35.       </Imports>
  36.       <Declarations>
  37.         <Literal>
  38.           <ID>text</ID>
  39.           <Type>String</Type>
  40.           <ToolTip>The text to be displayed in the Windows Forms control.</ToolTip>
  41.           <Default>"TextBox1"</Default>
  42.         </Literal>
  43.         <Literal>
  44.           <ID>locationX</ID>
  45.           <Type>Integer</Type>
  46.           <ToolTip>The X coordinate of control's location.</ToolTip>
  47.           <Default>64</Default>
  48.         </Literal>
  49.         <Literal>
  50.           <ID>locationY</ID>
  51.           <Type>Integer</Type>
  52.           <ToolTip>The Y coordinate of the control's location.</ToolTip>
  53.           <Default>40</Default>
  54.         </Literal>
  55.         <Literal>
  56.           <ID>width</ID>
  57.           <Type>Integer</Type>
  58.           <ToolTip>The width of control.</ToolTip>
  59.           <Default>100</Default>
  60.         </Literal>
  61.         <Literal>
  62.           <ID>height</ID>
  63.           <Type>Integer</Type>
  64.           <ToolTip>The height of control.</ToolTip>
  65.           <Default>20</Default>
  66.         </Literal>
  67.         <Object>
  68.           <ID>controlType</ID>
  69.           <Type>Control</Type>
  70.           <ToolTip>Replace with the Type of control to add.</ToolTip>
  71.           <Default>TextBox</Default>
  72.         </Object>
  73.         <Literal>
  74.           <ID>controlName</ID>
  75.           <Type>String</Type>
  76.           <ToolTip>The variable name of the control.</ToolTip>
  77.           <Default>TextBox1</Default>
  78.         </Literal>
  79.         <Literal>
  80.           <ID>tabIndex</ID>
  81.           <Type>Integer</Type>
  82.           <ToolTip>The the tab order value.</ToolTip>
  83.           <Default>0</Default>
  84.         </Literal>
  85.       </Declarations>
  86.       <Code Language="VB" Kind="method body"><![CDATA[    Dim $controlName$ As New $controlType$()
  87.     With $controlName$
  88.         .Location = New Point($locationX$, $locationY$)
  89.         .Size = New Size($width$, $height$)
  90.         .TabIndex = $tabIndex$
  91.         .Text = $text$
  92.     End With
  93.     Controls.Add($controlName$)
  94.  
  95. ]]></Code>
  96.     </Snippet>
  97.   </CodeSnippet>
  98. </CodeSnippets>