Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / July 2004

Tip: Looking for answers? Try searching our database.

Multiple event handlers to a class, is it possible?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
G. Tarazi - 26 Jul 2004 21:38 GMT
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
Andrew Ma [MSFT] - 26 Jul 2004 22:40 GMT
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";

     }

}

Signature

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.

 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. Tarazi - 27 Jul 2004 20:39 GMT
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";

     }

}

Signature

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
news:%23o2QOC1cEHA.4092@TK2MSFTNGP10.phx.gbl...
 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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.