[C#]Input box

Discussion in 'Code Snippets and Tutorials' started by the_skip, Jul 24, 2007.

  1. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    This is a very simple C# input box class to make your life a little easier
    Code (C#):
    1. <div class="csharp" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #0600FF;">namespace</span> Igloo_Ab</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> linputbox : <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Form</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">TextBox</span> textBox1;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">ComponentModel</span>.<span style="color: #0000FF;">Container</span> components = <span style="color: #0600FF;">null</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">TextBox</span> textbox2;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Button</span> button2;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Button</span> button1;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Label</span> label1;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> linputbox<span style="color: #000000;">(</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            InitializeComponent<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> Dispose<span style="color: #000000;">(</span><span style="color: #FF0000;">bool</span> disposing<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">if</span> <span style="color: #000000;">(</span>disposing<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">                <span style="color: #0600FF;">if</span> <span style="color: #000000;">(</span>components != <span style="color: #0600FF;">null</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">                <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">                    components.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">                <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">(</span>disposing<span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> InitializeComponent<span style="color: #000000;">(</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Label</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">TextBox</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Button</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Button</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">SuspendLayout</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// label1</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">AutoSize</span> = <span style="color: #0600FF;">true</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">Location</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Point</span><span style="color: #000000;">(</span><span style="color: #FF0000;">12</span>, <span style="color: #FF0000;">9</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">Name</span> = <span style="color: #808080;">"label1"</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">Size</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Size</span><span style="color: #000000;">(</span><span style="color: #FF0000;">172</span>, <span style="color: #FF0000;">13</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">TabIndex</span> = <span style="color: #FF0000;">0</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"What do you want to add to the list"</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// textBox1</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span>.<span style="color: #0000FF;">Location</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Point</span><span style="color: #000000;">(</span><span style="color: #FF0000;">8</span>, <span style="color: #FF0000;">32</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span>.<span style="color: #0000FF;">Name</span> = <span style="color: #808080;">"textBox1"</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span>.<span style="color: #0000FF;">Size</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Size</span><span style="color: #000000;">(</span><span style="color: #FF0000;">175</span>, <span style="color: #FF0000;">20</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span>.<span style="color: #0000FF;">TabIndex</span> = <span style="color: #FF0000;">1</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// button1</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">Location</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Point</span><span style="color: #000000;">(</span><span style="color: #FF0000;">8</span>, <span style="color: #FF0000;">58</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">Name</span> = <span style="color: #808080;">"button1"</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">Size</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Size</span><span style="color: #000000;">(</span><span style="color: #FF0000;">66</span>, <span style="color: #FF0000;">21</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">TabIndex</span> = <span style="color: #FF0000;">2</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"Add"</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">UseVisualStyleBackColor</span> = <span style="color: #0600FF;">true</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span>.<span style="color: #0000FF;">Click</span> += [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">EventHandler</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1_Click_1</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// button2</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">Location</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Point</span><span style="color: #000000;">(</span><span style="color: #FF0000;">118</span>, <span style="color: #FF0000;">58</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">Name</span> = <span style="color: #808080;">"button2"</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">Size</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Size</span><span style="color: #000000;">(</span><span style="color: #FF0000;">66</span>, <span style="color: #FF0000;">21</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">TabIndex</span> = <span style="color: #FF0000;">3</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"Cancel"</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">UseVisualStyleBackColor</span> = <span style="color: #0600FF;">true</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span>.<span style="color: #0000FF;">Click</span> += [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">EventHandler</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2_Click</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// linputbox</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #008080; font-style: italic;">// </span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">AutoScaleDimensions</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">SizeF</span><span style="color: #000000;">(</span>6F, 13F<span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">AutoScaleMode</span> = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">AutoScaleMode</span>.<span style="color: #0000FF;">Font</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">ClientSize</span> = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Size</span><span style="color: #000000;">(</span><span style="color: #FF0000;">188</span>, <span style="color: #FF0000;">82</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button2</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">button1</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">textBox1</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Controls</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">label1</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">FormBorderStyle</span> = <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">FormBorderStyle</span>.<span style="color: #0000FF;">FixedToolWindow</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Name</span> = <span style="color: #808080;">"linputbox"</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">"Add Item"</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Load</span> += [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] <span style="color: #000000;">System</span>.<span style="color: #0000FF;">EventHandler</span><span style="color: #000000;">(</span><span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Threadt_Load</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">ResumeLayout</span><span style="color: #000000;">(</span><span style="color: #0600FF;">false</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">PerformLayout</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> textBox1_KeyDown<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender,</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">KeyEventArgs</span> e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">if</span> <span style="color: #000000;">(</span>e.<span style="color: #0000FF;">KeyCode</span> ==  <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Keys</span>.<span style="color: #0000FF;">Enter</span><span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">                <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> ShowInputBox<span style="color: #000000;">(</span><span style="color: #FF0000;">string</span> strquestion<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            linputbox box = [url=http://www.google.com/search?q=new+msdn.microsoft.com]<span style="color: #008000;">new</span>[/url] linputbox<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            box.<span style="color: #0000FF;">label1</span>.<span style="color: #0000FF;">Text</span> = strquestion;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            box.<span style="color: #0000FF;">ShowDialog</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">return</span> box.<span style="color: #0000FF;">textBox1</span>.<span style="color: #0000FF;">Text</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> InputBox_Load<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> button1_Click<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> button2_Click<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            textBox1.<span style="color: #0000FF;">Text</span> = <span style="color: #808080;">""</span>;</li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> button1_Click_1<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">            <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> Threadt_Load<span style="color: #000000;">(</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">{</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">        <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">    <span style="color: #000000;">}</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"> </li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #000000;">}</span></li></ol></div>
    Call it by string answer = inputbox.ShowInputBox("Wahterer");
    I'll make this in vb.net very soon. PS Expon is there C# coding highlights since you'll be seing alot of that from me