FormEvents_Loading HELP!!! - InfoPath Dev
in

InfoPath Dev

FormEvents_Loading HELP!!!

Last post 01-28-2008 01:24 AM by omomani. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-28-2008 01:22 AM

    FormEvents_Loading HELP!!!

    Hi all, i'm trying to switch my form view based on a given field's value named "viewName"..... i wrote the following code :-

    Dim MyNav As XPathNavigator MyNav = Me.MainDataSource.CreateNavigator()

    Dim ViewValue As XPathNavigator = MyNav.SelectSingleNode("/my:myFields/my:viewName", Me.NamespaceManager)

     e.SetDefaultView(ViewValue.Value)

     but when i want to instantiate a form from this template i'm given the following error message:((

    The given key was not present in the dictionary.

    System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
    at System.ThrowHelper.ThrowKeyNotFoundException()
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.ViewInfoCollectionHost.<>c__DisplayClass4.<get_Item>b__3()
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.ExecuteOMCallWithExceptions(OMCall d, ExceptionFilter exceptionFilter)

    An entry has been added to the Windows event log of the server.
    Log ID:5337
    ))
     
    can anyone help??
    though, if i write  e.SetDefaultView("View 2") it works fine, ithink my problem is in getting the viewName field's value!
     
    thanks.
    Osama Momani.
  • 01-28-2008 01:24 AM In reply to

    Re: FormEvents_Loading HELP!!!

    forgot to tell you that the code is in FormEvents_Loading event!! :)

    thanks again.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.