Aisha Srivastava

Aisha Srivastava

  • NA
  • 230
  • 28.7k

Delete table from webbrowser control in windows form app.

Jan 31 2015 3:55 AM
 We have to  delete the table at once not by the given bold code removing each row...
 
 Please Instruct me it will be a great help...any change in code below is really appreciated...
 
public void DeleteTable()
{
mshtmlTable table = null;
mshtmlTableRow row = null;
mshtmlTableCell cell = null;
GetTableElement(out table, out row, out cell);
HtmlElement table1 = getTableHTMLElement();
if (table1 != null)
{
try
{
//foreach (mshtml.IHTMLTableRow row in table1.rows)
//{
// foreach (mshtml.IHTMLTableCell cell in row.cells)
// {
// row.deleteCell();
// }
//}
}
catch (Exception ex)
{
throw new HtmlEditorException("Unable to delete a table", "tabledelete", ex);
}
}
else
{
throw new HtmlEditorException("Table not currently selected ", "tabledelete");
}
}

Answers (1)