<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/28927.aspx</link><pubDate>Sat, 24 May 2008 06:16:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:28927</guid><dc:creator>Cutejon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/28927.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=28927</wfw:commentRss><description>&lt;p&gt;Hi Clay, &lt;/p&gt;&lt;p&gt;My original problem was to know how to use DavAdapter in Infopath 2007 via VB script coding. My research then showed me, to use this class, I have to include _startup to get the variable for xdocument. Unfortunately testing it was without success. Can you please help me know where to declare this ?&amp;nbsp; Or know what steps to take to make xdocument available in my code, and in turn use DavAdapter.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Your help will be greatly appreciated.&lt;/p&gt;&lt;p&gt;links: http://www.infopathdev.com/forums/p/7891/28808.aspx#28808&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;thanks&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/27686.aspx</link><pubDate>Thu, 03 Apr 2008 20:58:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27686</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27686.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=27686</wfw:commentRss><description>&lt;p&gt;Do you need a method for auto asigning numbers? Which are unique and sequential.&amp;nbsp; Having the user create one or pull from a common list is usually problematic.&lt;/p&gt;
&lt;p&gt;I could show you a couple different possibilities. Email me if you are interested.&lt;/p&gt;</description></item><item><title>Re: Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/27685.aspx</link><pubDate>Thu, 03 Apr 2008 20:48:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27685</guid><dc:creator>michaelmwilson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27685.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=27685</wfw:commentRss><description>&lt;p&gt;WOW. That&amp;#39;s weird. Thanks to Clay&amp;#39;s post I revisited the OnLoad method, deleted it, and re-wrote the code. This fixed the issue. &lt;/p&gt;
&lt;p&gt;Thanks AGAIN Clay!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looks like the method signature was incorrect:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;It changed from: 
&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;[&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;InfoPathEventHandler&lt;/font&gt;&lt;font size="2"&gt;(EventType = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;InfoPathEventType&lt;/font&gt;&lt;font size="2"&gt;.OnLoad)]&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; OnLoad(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;DocReturnEvent&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;To:&lt;/p&gt;[&lt;font color="#2b91af" size="2"&gt;InfoPathEventHandler&lt;/font&gt;&lt;font size="2"&gt;(EventType = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;InfoPathEventType&lt;/font&gt;&lt;font size="2"&gt;.OnLoad)]&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; FormEvents_OnLoad(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;DocReturnEvent&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;}&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/27684.aspx</link><pubDate>Thu, 03 Apr 2008 20:36:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27684</guid><dc:creator>michaelmwilson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27684.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=27684</wfw:commentRss><description>&lt;p&gt;Clay,&lt;/p&gt;
&lt;p&gt;Thanks for the reply. For some reason, when I place this code in the OnLoad event, it doesn&amp;#39;t run, that&amp;#39;s why it&amp;#39;s in the _Startup to begin with. JobNumber is a text field entered, but it is also the filename.Yes, it does need to be unique and part of the validation is to eliminate duplicate job numbers in forms started by two different users. I.E. Person A starts Job 123 and before he saves, person B starts Job 123. The form currently allows for the last saved job to overwrite.&lt;/p&gt;</description></item><item><title>Re: Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/27683.aspx</link><pubDate>Thu, 03 Apr 2008 19:39:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27683</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27683.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=27683</wfw:commentRss><description>&lt;p&gt;I believe you would want to put your code in Onload event. that is the typical place.&lt;/p&gt;
&lt;p&gt;On Startup there has not been a form loaded yet and that is why you can not make references.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How are you assigning JobNumber?&amp;nbsp; Does it come from a database? does it need to be unique?&lt;/p&gt;</description></item><item><title>Error in _Startup()</title><link>https://www.infopathdev.com:443/forums/thread/27682.aspx</link><pubDate>Thu, 03 Apr 2008 19:20:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:27682</guid><dc:creator>michaelmwilson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/27682.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=27682</wfw:commentRss><description>&lt;p&gt;I added code to the _Startup method to &amp;nbsp;aid in form validation on submit. Basically we want to see if a field has been changed since the form was loaded. If so we preform custom validation based on the original/new value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is my startup code:&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; _Startup(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Application&lt;/font&gt;&lt;font size="2"&gt; app, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;XDocument&lt;/font&gt;&lt;font size="2"&gt; doc)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.thisXDocument = doc;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.thisApplication = app;&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;openingJobNumber = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;.thisXDocument.DOM.selectSingleNode(&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:job/my:number&amp;quot;&lt;/font&gt;).text;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;Here is the error:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;System.InvalidOperationException&lt;br /&gt;The _Startup or _Shutdown method in this form&amp;#39;s code contains one or more calls to members of the Microsoft.Office.Interop.InfoPath.SemiTrust namespace. Calls to this namespace from these methods are not permitted.&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp;amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)&lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.InfoPathOMHelper.Run(String assemblyFullPathName)&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>