Hi,
For example if your rule is "When user checks the field1 check box then you need to set some value to the field2 text box field".
For above thing you need to write the code in field1 OnAfterChange like this.
[InfoPathEventHandler(MatchPath = "/my:myFields/my:field1", EventType = InfoPathEventType.OnAfterChange)]
Public void field1_OnAfterChange (DataDOMEvent e)
{
// Write your code here to restore the global state.
If (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
if (e.Site.text == "True")
{
thisXDocument.DOM.selectSingleNode ("/my: myFields/my: field2").text = "Sample App";
}
}
Like this you can set all your rules in the code itself.