Access Infopath UI control on the form in .NET

X

Xin Chen

I want to modify some property of the form when a event happen, for example,
disable certain textbox when user click on a radio button. I went though a
lot of document, but they only show how to access the data(via
thisXDocument), but not hte UI object itself. Does anyone know how to acces
the UI control on the from so that I can disable or enable then
programmatically? Thanks

--xin chen
 
F

Franck Dauché

Unfortunately you can't control your UI by .Net code. Keep in mind that your
form could be displayed in IE as html (xml + xsl). Your code couldn't make
it there, as a result, IP doesn't support that functionality. The only way
to achieve "advanced" behavior from your UI (not provided by IP) is to
manipulate your xsl file by hand.

Franck Dauché
 
S

Scott L. Heim [MSFT]

Hi Xin Chen,

Frank is correct - InfoPath is completely data driven so you do not have
programmatic access to the controls. However, you can achieve what you want
through "Conditional Formatting."

- Right-click on your text box and choose Properties
- Select the Display tab
- Click the Conditional Formatting button
- Click Add
- From the first box, select your option button field
- From the second box, select "is equal to"
- From the third box, choose Type a number and enter the value to test
against (i.e. if you have 2 option buttons typically these have values of 1
and 2)
- Select the formatting you desire (i.e. hiding the control, making it
read-only, etc.)

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top