Multiple event handlers to a class, is it possible?

G

G. Tarazi

The compiler is giving me an error in this code:



[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section1", EventType=InfoPathEventType.OnAfterChange)]


[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section2", EventType=InfoPathEventType.OnAfterChange)]


[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section3", EventType=InfoPathEventType.OnAfterChange)]


public void TermSheetSection_OnAfterChange(DataDOMEvent e)

{

if (e.IsUndoRedo)

{

return;

}

if (e.Parent.selectSingleNode("NS:IxIsChanged").text == "false")

{

e.Parent.selectSingleNode("NS:IxIsChanged").text == "true";

}

}



Is there any workaround?



Thank you
 
G

G. Tarazi

Thanks for the help, this is what I did, And I end up with 1000 lines of
code :) , beautiful nice code that does nothing :), except handling the
events, All the same


Why don't you just do something like this:
[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section1",
EventType=InfoPathEventType.OnAfterChange)]

public void TermSheetSection1_OnAfterChange(DataDOMEvent e)

{

TermSheetSection_OnAfterChange(e);

}


[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section2",
EventType=InfoPathEventType.OnAfterChange)]


public void TermSheetSection2_OnAfterChange(DataDOMEvent e)

{

TermSheetSection_OnAfterChange(e);

}

[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section3",
EventType=InfoPathEventType.OnAfterChange)]


public void TermSheetSection_OnAfterChange(DataDOMEvent e)

{

if (e.IsUndoRedo)

{

return;

}

if (e.Parent.selectSingleNode("NS:IxIsChanged").text == "false")

{

e.Parent.selectSingleNode("NS:IxIsChanged").text == "true";

}

}


--
Andrew J. Ma
Software Test Engineer
Microsoft Office InfoPath
http://blogs.msdn.com/ajma
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.


"G. Tarazi" <Tarazi (at) LiveTechnologies.ca> wrote in message
The compiler is giving me an error in this code:



[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section1",
EventType=InfoPathEventType.OnAfterChange)]


[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section2",
EventType=InfoPathEventType.OnAfterChange)]


[InfoPathEventHandler(MatchPath="/NS:DxIPForm/NS:IPForm/NS:section3",
EventType=InfoPathEventType.OnAfterChange)]


public void TermSheetSection_OnAfterChange(DataDOMEvent e)

{

if (e.IsUndoRedo)

{

return;

}

if (e.Parent.selectSingleNode("NS:IxIsChanged").text == "false")

{

e.Parent.selectSingleNode("NS:IxIsChanged").text == "true";

}

}



Is there any workaround?



Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top