When I was doing customization in InfoPath, I had some difficulties to find the XPath of user controls, after spending several minutes I found a way to determine the XPath in InfoPath 2007. I just wanted to share this in my blog, because there is no any straight forward answer in the web.
Step 1: Create a blank InfoPath template and add an User Control from the Controls Design Tasks (On your right hand side of the InfoPath). In this example I have added two Text Boxes and a Button and re-named them.
Step 2: Select the user control and click the Data Source in the Design Tasks.
Step 3: Now, you can see the selected control’s highlighted name in the Drop Down List.
Step 4: Click the Drop Down arrow and select the Copy XPath in the list.
Step 5: That’s all, you can use the XPath in your code. 🙂