Microsoft KB Archive/194898

= FIX: DhRow.removeAll Causes a com.ms.com.ComFailException =

Article ID: 194898

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q194898



SYMPTOMS
When you call DhRow.removeAll the following exception occurs:

com.ms.com.ComFailException: Unknown error(0x800a0258)

at com/ms/wfc/html/om/IHTMLElement.setOuterHTML (IHTMLElement.java)

at com/ms/wfc/html/DhElementArray.removeInternal (DhForm.java)

at com/ms/wfc/html/DhElementArray.remove (DhForm.java)

at com/ms/wfc/html/DhBaseContainer.removeChildren (DhBaseContainer.java)

at com/ms/wfc/html/DhBaseContainer.removeAll (DhBaseContainer.java)



RESOLUTION
To work around this problem, remove each cell in the row individually using the DhRow.remove method. For example, do the following to remove all of the cells from a DhRow element called row1: DhCell[] cells = row1.getCells; if (cells != null) {

for (int i = 0; i < cells.length; ++i) row1.remove(cells[i]);

}



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
 In Visual J++, select New Project from the File menu. In the New Project dialog box, click the New tab. In the Visual J++ Projects tree, click Web Pages. Click Code-Behind HTML. Click Open to create the project.  Modify Class1.java as follows: import com.ms.wfc.html.*; import com.ms.wfc.core.*; import com.ms.wfc.ui.*; public class Class1 extends DhDocument {  public Class1 {     initForm; }  private void initForm {  }   protected void onDocumentLoad(Object sender, Event e)   { this.add(new DhHorizontalRule); DhTable table=new DhTable; add(table); DhRow row1,row2; DhCell cell; row1=new DhRow; table.add(row1); cell=new DhCell("Cell1"); row1.add(cell); cell=new DhCell("Cell2"); row1.add(cell); cell=new DhCell("Cell3"); row1.add(cell); row2=new DhRow; table.add(row2); cell=new DhCell("Cell3"); row2.add(cell); cell=new DhCell("Cell4"); row2.add(cell); cell=new DhCell("Cell5"); row2.add(cell); row1.removeAll;

// to workaround the problem, comment out the above call to removeAll // and uncomment the following lines: //   DhCell[] cells = row1.getCells; //   if (cells != null) { //      for (int i = 0; i < cells.length; ++i) //         row1.remove(cells[i]); //   }   } }                        </li>  Modify Page1.html as follows: <HTML> <BODY> <OBJECT classid="java:com.ms.wfc.html.DhModule" height=0 width=0 ... VIEWASTEXT> <PARAM NAME=__CODECLASS VALUE=Class1> <PARAM NAME=CABBASE VALUE=Project1.CAB> </OBJECT>

</BODY> </HTML> </li> Run the project.</li></ol>

RESULT: The following exception error occurs:

com.ms.com.ComFailException: Unknown error(0x800a0258)

<div class="references_section">