请教,webbrower 和 HtmlDocument 分别属于哪个命名空间

thinkingmen 2008-10-23 06:43:47
请教,webbrower 和 HtmlDocument 分别属于哪个命名空间

我定义时,出现未定义类型
...全文
443 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
春天的气息 2009-06-18
  • 打赏
  • 举报
回复
C#复制代码
private void DisplayCustomersTable()
{
DataSet customersSet = new DataSet();
DataTable customersTable = null;
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Customers", "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;");
sda.Fill(customersTable);
customersTable = customersSet.Tables[0];

if (webBrowser1.Document != null)
{
HtmlElement tableRow = null;
HtmlElement headerElem = null;

HtmlDocument doc = webBrowser1.Document;
HtmlElement tableElem = doc.CreateElement("TABLE");
doc.Body.AppendChild(tableElem);

HtmlElement tableHeader = doc.CreateElement("THEAD");
tableElem.AppendChild(tableHeader);
tableRow = doc.CreateElement("TR");
tableHeader.AppendChild(tableRow);

foreach (DataColumn col in customersTable.Columns)
{
headerElem = doc.CreateElement("TH");
headerElem.InnerText = col.ColumnName;
tableRow.AppendChild(headerElem);
}

// Create table rows.
HtmlElement tableBody = doc.CreateElement("TBODY");
tableElem.AppendChild(tableBody);
foreach (DataRow dr in customersTable.Rows)
{
tableRow = doc.CreateElement("TR");
tableBody.AppendChild(tableRow);
foreach (DataColumn col in customersTable.Columns)
{
Object dbCell = dr[col];
HtmlElement tableCell = doc.CreateElement("TD");
if (!(dbCell is DBNull))
{
tableCell.InnerText = dbCell.ToString();
}
tableRow.AppendChild(tableCell);
}
}
}
}

thinkingmen 2008-10-23
  • 打赏
  • 举报
回复
我找不到啊

我编写的是aspx的文件
lovehongyun 2008-10-23
  • 打赏
  • 举报
回复
在控件栏按右键,选择“添加/移除项”,选COM组件,选中“Microsoft Web Browser”。

lovehongyun 2008-10-23
  • 打赏
  • 举报
回复
添加webbrowers引用

16,717

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧