c# send a keypress to the form only
<p>So I have a form with a webbrowser in it. It needs to put some text into a text field input and then it has to press enter to send the text. But the problem I got is when I am doing something else it tries to press enter in that program I am currently using.</p>

<pre><code>webBrowser1.Document.GetElementById("chatMessage").SetAttribute("Test");
webBrowser1.Select();
webBrowser1.Document.GetElementById("chatMessage").Focus();
System.Windows.Forms.SendKeys.SendWait("{ENTER}");
</code></pre>

<p>Any idea on what I should use instead?</p>

<p>Here is the html code.</p>

<pre><code>&lt;form id="chatForm"&gt;
   &lt;div style="margin:5px"&gt;        
        &lt;div class="form-group" style="margin-bottom:5px"&gt;
           &lt;input type="text" class="form-control" placeholder="Type here to chat..." id="chatMessage" maxlength="200" autocomplete="off"&gt;
        &lt;/div&gt;                          

        &lt;div class="pull-left"&gt;
           &lt;strong&gt;Users Online: &lt;span id="isonline"&gt;0&lt;/span&gt;&lt;/strong&gt;
        &lt;/div&gt;

        &lt;div class="checkbox pull-right" style="margin:0px"&gt;
           &lt;label class="noselect"&gt;
           &lt;input type="checkbox" id="scroll"&gt;
           &lt;strong&gt;Pause chat&lt;/strong&gt;
           &lt;/label&gt;
        &lt;/div&gt;

        &lt;br&gt;

        &lt;div class="pull-left"&gt;
           &lt;a href="#" data-toggle="modal" data-target="#chatRules"&gt;Chat Rules&lt;/a&gt;
        &lt;/div&gt;

    &lt;/div&gt;

&lt;/form&gt;
</code></pre>