Within infopath form I have fields that are stored on the SQL Datbase. No problem. Using this assistance
http://weblogs.asp.net/jan/archive/2004/03/16/90533.aspx I have a dropdown list of all the users of a Site bound to "SubmittedBy". (this dropdown list is an XML file)
Now I have done a simple "Test" button (using vb.net) to Alert who the currently selected user is. (I open the form, select a user from the drop down list and press "Test")
Here's the code:
<InfoPathEventHandler(MatchPath:="BTN_TEST", EventType:=InfoPathEventType.OnClick)> _
Public Sub BTN_TEST_OnClick(ByVal e As DocActionEvent)
' Write your code here.
Try
Dim cVal = thisXDocument.DOM.selectSingleNode("//d:TrRevCostMain/SubmittedBy")
If Not cVal Is Nothing Then
thisXDocument.UI.Alert(cVal.text)
Else
thisXDocument.UI.Alert("Not Selected")
End If
Catch ex As Exception
thisXDocument.UI.Alert(ex.Message)
End Try
End SubFor the N'TH Time, it always alerts "Not Selected", no matter if I select a user in the dropdown list or not. So the condition (Not cVal Is Nothing) is ALWAYS TRUE, cVal is ALWAYS 'Nothing'
I have tried to retreive other element values from the form, eg simple text boxes which are returned correctly.
Any idea why? It seems so difficult to retrieve a simple value from a drop down list?
This is driving me c.r.a.z.y
Thanks.