Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2006

Tip: Looking for answers? Try searching our database.

View is null?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bshea - 01 Nov 2006 20:29 GMT
I have a form being built where I want to test for a field value and then
ensure the form's view is set correctly based on that value.

pseudo-code:
OnLoad()
{
check for status_field value
If (status_field value == "new")  XDocument.View.SwitchView("Request");
... more tests etc.

Problem:
When this occurs in the OnLoad function the view object is returning null
and then I can't test views, set views, etc.

Attempting to manually create a view object reference fails, with the same
result (obj doesn't exist or is null) but just on differentlines of code.

Any thoughts on how I can get the view to set correctly based on the field
value?
S.Y.M. Wong-A-Ton - 02 Nov 2006 06:53 GMT
Try

XDocument.ViewInfos["Request"].IsDefault = true;

instead of

XDocument.View.SwitchView("Request");

---
S.Y.M. Wong-A-Ton

> I have a form being built where I want to test for a field value and then
> ensure the form's view is set correctly based on that value.
[quoted text clipped - 15 lines]
> Any thoughts on how I can get the view to set correctly based on the field
> value?
bshea - 02 Nov 2006 18:58 GMT
This seems to work, thanks!  (still testing all my use cases but the initial
case tested success.

> Try
>
[quoted text clipped - 26 lines]
> > Any thoughts on how I can get the view to set correctly based on the field
> > value?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.