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.