Saturday, October 6, 2012

Set the value of a field I

Problem: You have a text box control on a form and you want to set its component to be equal to a piece of text.

Create a form, add two text boxes named field 1 and field 2. After that set the default value of field 1 to "This is my value".

Finally add the code below to the FormEvents_Loading() event handler

Dim mainDS As XPathNavigator = MainDataSource.CreateNavigator

Dim Field1 As XPathNavigator = mainDS.SelectSingleNode("/my:myFields/my:field1", NamespaceManager)


Dim Field2 As XPathNavigator = mainDS.SelectSingleNode("/my:myFields/my:field2", NamespaceManager)


Field2.SetValue(Field1.Value)

Preview the form and you will see that field 2 now has the same value as field 1

No comments:

Post a Comment

About Me

My photo
Toronto, Ontario, Canada
MBA, M.Sc. & MCP