title: How to update DotNetNuke's HTML module content through code?
body: <p>I'm working on a DNN module which needs to be able to update the HTML content of existing HTML modules.  Does anyone know how to do this through code?</p>
  
  <p>I've determined the content gets stored in the HtmlText table, but I'd rather not write directly to the table.  Does anyone knows how to accomplish this using the DNN API?  </p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p><strong>Here's the solution I found, with the help of <a href="https://stackoverflow.com/users/13460/mika">mika</a> &amp; <a href="https://stackoverflow.com/users/2688/bdukes">bdukes</a> :</strong></p>
  
  <pre><code>''' &lt;summary&gt;Add HTML contest to an existing HTML module.&lt;/summary&gt;
  Private Sub AddHTML(ByVal ModuleID As Integer, ByVal HTML As String)
      Try
          Dim oHTML As New DotNetNuke.Modules.Html.SqlDataProvider
          '-- i'm not sure what "history" should be set for in the method below.
          '-- i suspect it means "version history", which 5 seems to be the default based on what i've read.
          oHTML.AddHtmlText(ModuleID, HTML, 1, 1, UserId, 5)
  
      Catch ex As Exception
          'failure
      End Try
  End Sub
  </code></pre>
  
  <p><strong>Notes:</strong></p>
  
  <ul>
  <li><p>This routine adds HTML content to a
  just-created HTML/Text module, so
  checking for existing HTML content
  isn't necessary.</p></li>
  <li><p>I'm a little fuzzy about the 3rd and
  6th parameters (StateID &amp; History),
  although it seems to be
  working correctly.  If anyone knows
  more about them, I'd like to
  know the correct way to set these parameters.</p></li>
  </ul>