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 / September 2004

Tip: Looking for answers? Try searching our database.

Unusal xOptional::remove behavior (on my view)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
duncans - 08 Sep 2004 01:39 GMT
I have the following simple select case in my code (VB.NET managed code) to
remove an optional section if the user selection from a dropdownlist box
changes:

'Remove any existing optional sections.
           Select Case e.OldValue
               Case "2"

               Case "7"

               Case "12"

                   'Mileage
                   thisXDocument.View.SelectNode
(thisXDocument.DOM.selectSingleNode("/my:myFields/my:ExpenseReport/my:ExpenseReportDetail/my:MileageExpense"),
System.Reflection.Missing.Value, System.Reflection.Missing.Value)
                   thisXDocument.View.ExecuteAction("xOptional::remove",
"group3_3")
           End Select

The code removes the desired optiona section BUT when the last statement is
excuted, instead of dropping out of the select case loop, the entire loop
tries to execute again and throws an error. If I click through the error the
optional section has indeed been removed. Does anyone have any insight as to
why this might be happening? Thanks.
Signature

Duncan Sutherland

Jerry Thomas [MSFT] - 08 Sep 2004 23:20 GMT
If this is on the "OnAfterChange" event, it is because we have to go through
twice.
The first time we go though, we change the the value to blank and then we
come through again and change it to the value you selected or entered.

Try something like this:
function msoxd_my_field2::OnAfterChange(eventObj)

{

     if (eventObj.IsUndoRedo || eventObj.Operation != "Insert")

     {

           return;

     }

     //do whatever you want here...

}

Signature

Jerry Thomas[MSFT]
<Jerryth@online.microsoft.com>
Microsoft Office InfoPath
---------------------------------------
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.

> I have the following simple select case in my code (VB.NET managed code) to
> remove an optional section if the user selection from a dropdownlist box
[quoted text clipped - 10 lines]
>                     'Mileage
>                     thisXDocument.View.SelectNode

(thisXDocument.DOM.selectSingleNode("/my:myFields/my:ExpenseReport/my:Expens
eReportDetail/my:MileageExpense"),
> System.Reflection.Missing.Value, System.Reflection.Missing.Value)
>                     thisXDocument.View.ExecuteAction("xOptional::remove",
[quoted text clipped - 6 lines]
> optional section has indeed been removed. Does anyone have any insight as to
> why this might be happening? Thanks.
 
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.