vb 发送html邮件,如何通过电子邮件发送动态创建的htmltable - vb.net

我创建了一个htmlTable,我想通过电子邮件发送它:

Dim MyRow As New HtmlTableRow

Dim cellCost, cellDisplayName, cellMoreInfo As New HtmlTableCell

Dim tableAttributes As New HtmlTable

tableAttributes.ID = "test"

cellCost.InnerText = "$45.00"

cellDisplayName.InnerText = "I am display Name"

cellMoreInfo.InnerText = "I am more information"

MyRow.Cells.Add(cellCost)

MyRow.Cells.Add(cellDisplayName)

MyRow.Cells.Add(cellMoreInfo)

tableAttributes.Rows.Add(MyRow)

PlaceHolder1.Controls.Add(tableAttributes)

当试图通过电子邮件发送tableAttributes全局变量时...那就是我遇到麻烦的地方:

Message.Body = tableAttributes.anything< - 失败

如何创建动态生成的表然后通过电子邮件发送它?

**更新 - 提供了解决方案

哈哈!它奏效了,你真棒。这是我根据你的建议创造的:

Dim SB As New StringBuilder()

Dim SW As New StringWriter(SB)

Dim htmlTW As New HtmlTextWriter(SW)

Dim x As New HtmlTable

x = Session("table")

x.RenderControl(htmlTW)

Dim sTable As String = SB.ToString()

Response.Write("*" & sTable & "*")