Hi again,
ok i really tried every combination with the textbox fromula but i didn't work. now i am using the OnAfterChangeEvent from the drop down list but unfortunately i always get this error when previewing the form and making a selection from the ddl.
System.Runtime.InteropServices.COMException
Expected token ']' found 'NAME'.
/myFields/group1/group2[Value = 24-->hours<--]/DisplayName
at Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMNode.selectSingleNode(String queryString)
at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMDocument50Wrapper.selectSingleNode(String queryString)
at Microsoft.Office.Interop.InfoPath.SemiTrust.DOMDocument50Wrapper.selectSingleNode(String queryString)
at Quotation_Application_Review.Quotation_Application_Review.ddlRequestType_OnAfterChange(DataDOMEvent e) in c:\documents and settings\jlorig\my documents\visual studio projects\quotation_application review\formcode.cs:line 101
at Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnAfterChange(DataDOMEvent pDataDOMEvent)
Here is the code i am using:
[InfoPathEventHandler(MatchPath="/my:myFields/my:ddlRequestType", EventType=InfoPathEventType.OnAfterChange)]
public void ddlRequestType_OnAfterChange(DataDOMEvent e)
{
// Write code here to restore the global state.
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
// A field change has occurred and the DOM is writable. Write code here to respond
// to the changes.
string val = e.Source.text;
IXMLDOMDocument3 displayName = (IXMLDOMDocument3)thisXDocument.GetDOM("requestTypes");
//displayName.setProperty("SelectionNamespaces", displayName.getProperty("SelectionNamespaces"));
string displayNameString = displayName.selectSingleNode("/myFields/group1/group2[Value = " + val + "]/DisplayName" ).text;
// set the textbox
IXMLDOMNode nodeRequest = thisXDocument.DOM.selectSingleNode("my:myFields/my:requestTest");
nodeRequest.text = displayNameString;
}
Can someone help ?
Thx in advance
Listen to Motörhead cos they play Rock'n Roll :)