Changing Infopath Views Through FormControl

J

Jithendrian. R

I need to use the infopath form in my windows application. So by using
FormControl i am loading the infopath form. The thing is, the view inside
the infopath form has to be loaded based on the person using the application.
If the user is admin then his corresponding view has to be loaded. So i
implemented Microsoft.Office.InfoPath.IInitEventHandler event and set the
window instance as the Initialize event handler in the form Load event. the
followinfg is the code

public void InitEventHandler(object sender,
Microsoft.Office.InfoPath.XmlForm xmlForm, out
Microsoft.Office.Interop.InfoPath.XdReadOnlyViewMode viewsReadOnlyMode)

{

viewName =
System.Configuration.ConfigurationManager.AppSettings["AdminView"];

xmlForm.ViewInfos.Initial = xmlForm.ViewInfos[viewName];

viewsReadOnlyMode =
Microsoft.Office.Interop.InfoPath.XdReadOnlyViewMode.xdDefault;

}

But then when i run my application the initial view is set to the required
view but what is getting displayed is the default view. The initail view is
nt dispalyed
Need help reagrding this
TIA
Cheers
Jithendrian. R
 

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