Share via


XPathNavigator Control in VB.NET

VB.NET and probably the other managed code languages uses a new syntax for specifying nodes and traversing XML in a form.   I don't claim to have a firm grasp on this, I only know what works.   Let's say you've got a field in your form whose value you set via rules or defaults, like a datetime field.   Below is how you would specify a function to get into your main datasource, get to the value, set it to a variable and then do something with it.  This may be basic info for some of you, but it's a different syntax to me and is worth noting here.

Private Function currentDateTime() As String

Dim mainDomNavigator As XPathNavigator = MainDataSource.CreateNavigator()

Dim todayNavigator As XPathNavigator = mainDomNavigator.SelectSingleNode("/dfs:myFields/my:TodaysDate", NamespaceManager)

Return todayNavigator.Value

End Function