title: FireEvent / RaiseEvent / InvokeMember - what to use in .NET, and how?
body: <p>I need to populate a number of dropdowns that each update the site.</p>
  
  <p>Using VBScript I could use <code>IE.Document.GetElementById("Blahblah").FireEvent</code> - but this isn't working in VB.NET. So I have attempted to use <code>RaiseEvent</code> and <code>InvokeMember</code> instead, but neither seems to work in updating the form.</p>
  
  <p>The HTML is:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="elements"&gt;
                      &lt;select name="_ctl0:MainContent:generateECodes_PackageDropdown" onchange="javascript:setTimeout('__doPostBack(\'_ctl0$MainContent$generateECodes_PackageDropdown\',\'\')', 0)" language="javascript" id="generateECodes_PackageDropdown"&gt;
      &lt;option selected="selected" value="0"&gt;- Select a package -&lt;/option&gt;
      &lt;option value="272"&gt;McAfee Internet Security&lt;/option&gt;
      &lt;option value="273"&gt;3-User McAfee Internet Security&lt;/option&gt;
      &lt;option value="274"&gt;McAfee Total Protection&lt;/option&gt;
      &lt;option value="275"&gt;3-User McAfee Total Protection&lt;/option&gt;
      &lt;option value="379"&gt;McAfee Mobile Security - Smartphone Edition&lt;/option&gt;
      &lt;option value="381"&gt;McAfee Mobile Security - Tablet Edition&lt;/option&gt;
      &lt;option value="430"&gt;McAfee LiveSafe&lt;/option&gt;
  
  &lt;/select&gt;
                      &lt;select name="_ctl0:MainContent:generateECodes_TermDropdown" onchange="javascript:setTimeout('__doPostBack(\'_ctl0$MainContent$generateECodes_TermDropdown\',\'\')', 0)" language="javascript" id="generateECodes_TermDropdown" disabled="disabled"&gt;
      &lt;option selected="selected" value="- Select a term -"&gt;- Select a term -&lt;/option&gt;
  
  &lt;/select&gt;
                      &lt;select name="_ctl0:MainContent:generateECodes_Languages" onchange="javascript:setTimeout('__doPostBack(\'_ctl0$MainContent$generateECodes_Languages\',\'\')', 0)" language="javascript" id="generateECodes_Languages" disabled="disabled"&gt;
      &lt;option selected="selected" value="- Select a language -"&gt;- Select a language -&lt;/option&gt;
  
  &lt;/select&gt;
                      &lt;a id="generateECodes_VanityURL"&gt;&lt;/a&gt;
                      &lt;select name="_ctl0:MainContent:generateECodes_StoreNumber" id="generateECodes_StoreNumber" disabled="disabled" style="display:none"&gt;
      &lt;option value="0"&gt;- Select a store -&lt;/option&gt;
      &lt;option selected="selected" value="1"&gt;1049 - Default Store&lt;/option&gt;
  
  &lt;/select&gt;
                      &lt;input name="_ctl0:MainContent:generateECodes_Required" type="text" maxlength="2" id="generateECodes_Required" onkeypress="return isNumberKey(event)"&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p>So I am trying something like this to populate it:</p>
  
  <pre><code>Helem = IEMcAfee.Document.GetElementById("generateECodes_PackageDropdown")
  
          Helem.SetAttribute("Value", "430")
          Helem.RaiseEvent("onchange")
  
          Helem = IEMcAfee.Document.GetElementById("generateECodes_TermDropdown")
  
          If SA6.Checked Then
              Helem.SetAttribute("Value", "5")
          ElseIf SA12.Checked Then
              Helem.SetAttribute("Value", "1")
          ElseIf SA24.Checked Then
              Helem.SetAttribute("Value", "2")
          ElseIf SA36.Checked Then
              Helem.SetAttribute("Value", "3")
          End If
      End If
      Helem.RaiseEvent("onchange")
  
      Helem = IEMcAfee.Document.GetElementById("generateECodes_Languages")
  
      Helem.SetAttribute("Value", "29")
      Helem.RaiseEvent("onchange")
  
      Helem = IEMcAfee.Document.GetElementById("generateECodes_StoreNumber")
  
      Helem.SetAttribute("Value", "230")
      Helem.RaiseEvent("onchange")
  
      Helem = IEMcAfee.Document.GetElementById("generateECodes_Required")
      Helem.InnerText = "1"
  
      IEMcAfee.Document.GetElementById("generateECodes_Button").Focus()
      Helem = IEMcAfee.Document.GetElementById("generateECodes_Button")
      Helem.InvokeMember("click")
  </code></pre>
  
  <p>I have tried to change <code>RaiseEvent</code> with <code>InvokeMember</code>, and I have tried changing <code>onchange</code> to anything I could think of.</p>
  
  <p>Any help would be much appreciated.</p>