Hi,
What I would like to do is copy the value that I have entered in the following sibling element from my reapeating-table. But I have an error when I try to modify the 15th element of this table. That send me the error:
quote:
Exception de HRESULT : 0x80043051
I Have try the two following code that send me the same error at the 15th occurence when I try to remove my xsi:nil attribute:
[InfoPathEventHandler(MatchPath="/CaseList/Case/Geschaeft/SHAB/SHABnr", EventType=InfoPathEventType.OnAfterChange)]
public void SHABnr_OnAfterChange(DataDOMEvent e)
{
if (e.IsUndoRedo)
{
return;
}
if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
{
return;
}
if (e.Site != e.Parent)
{
return;
}
if ("Insert" != e.Operation)
{
return;
}
string SHABNr = e.Source.text;
if (SHABNr != "")
{
IXMLDOMNode oRow = e.Source.parentNode.parentNode.parentNode.parentNode;
IXMLDOMNode oRows = oRow.parentNode;
IXMLDOMNode oNextRow = oRow.selectSingleNode("following-sibling::Case");
if (oNextRow != null && oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").text != SHABNr)
{
oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").attributes.removeNamedItem("xsi:nil");
oNextRow.selectSingleNode("Geschaeft/SHAB/SHABnr").text = SHABNr;
}
}
}
or with this one:
[InfoPathEventHandler(MatchPath="/CaseList/Case/Geschaeft/SHAB/Datum", EventType=InfoPathEventType.OnAfterChange)]
public void SHAB_Datum_OnAfterChange(DataDOMEvent e)
{
if (e.IsUndoRedo)
{
return;
}
if (e.Source.nodeType != DOMNodeType.NODE_TEXT)
{
return;
}
if (e.Site != e.Parent)
{
return;
}
if ("Insert" != e.Operation)
{
return;
}
string SHABDatum = e.Source.text;
if (SHABDatum != "")
{
IXMLDOMNode NextCase = e.Source.parentNode.parentNode.parentNode.parentNode.nextSibling;
if (NextCase != null && NextCase.selectSingleNode("Geschaeft/SHAB/Datum").text != SHABDatum)
{
NextCase.selectSingleNode("Geschaeft/SHAB/Datum").attributes.removeNamedItem("xsi:nil");
NextCase.selectSingleNode("Geschaeft/SHAB/Datum").text = SHABDatum;
}
}
}
I think I'm doing anything wrong but I dont understand what!
The problem that I dont understand is that I have anything in my IXMLDOMNode and the data inner is correct but infoapth cant remove this attribute. Why I dont know. Do you think that can be a bug?
Any idea?
Thanks
Thierry
Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
merci de lire ceci