Help.. SaveAs Button infopath 2010 Variable "" asign - InfoPath Dev
in

InfoPath Dev

Help.. SaveAs Button infopath 2010 Variable "" asign

Last post 03-01-2012 02:26 AM by dkanha. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-28-2012 05:00 AM

    • dkanha
    • Not Ranked
    • Joined on 02-28-2012
    • Posts 4

    Help.. SaveAs Button infopath 2010 Variable "" asign

    What's wrong with this code [Xdocument.SaveAs("C\")] = Variable 'Xdocument' is used before it has been assigned a value. A null reference exception could result at runtime. Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup AddHandler DirectCast(EventManager.ControlEvents("SaveAs"), ButtonEvent).Clicked, AddressOf SaveAs_Clicked End Sub Public Sub SaveAs_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs) Dim Xdocument As System.Configuration.Configuration Xdocument.SaveAs("C\") End Sub End Class End Namespace
  • 02-29-2012 10:26 AM In reply to

    Re: Help.. SaveAs Button infopath 2010 Variable "" asign

    I can think of at least two things: a) the name "c\" is not correct and doesn't resolve to a good file location, and b) you need to make sure your form's security setting is set to full trust to use this.
    Patrick Halstead
    Project Manager at Qdabra
  • 02-29-2012 06:25 PM In reply to

    • dkanha
    • Not Ranked
    • Joined on 02-28-2012
    • Posts 4

    Re: Help.. SaveAs Button infopath 2010 Variable "" asign

    To Patrick.. a) I have directed "C\" to "C:\".. b) I've also set the form as Full trusted.. This is the error I get!! Object reference not set to an instance of an object. at test.FormCode.SaveAs_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
  • 02-29-2012 08:13 PM In reply to

    Re: Help.. SaveAs Button infopath 2010 Variable "" asign

    Can you paste in your complete code?
    Patrick Halstead
    Project Manager at Qdabra
  • 03-01-2012 02:26 AM In reply to

    • dkanha
    • Not Ranked
    • Joined on 02-28-2012
    • Posts 4

    Re: Help.. SaveAs Button infopath 2010 Variable "" asign

    Imports Microsoft.Office.InfoPath Imports System Imports System.Xml Imports System.Xml.XPath Namespace test Public Class FormCode ' Medlemsvariabler understøttes ikke i webbrowseraktiverede formularer. ' I stedet for kan du læse, skrive og læse disse værdier i FormState- ' ordbogen ved hjælp af kode, som f.eks. følgende: ' ' Private Property _memberVariable() As Object ' Get ' _memberVariable = FormState("_memberVariable") ' End Get ' Set ' FormState("_memberVariable") = value ' End Set ' End Property ' BEMÆRK! Den følgende procedure kræves af Microsoft InfoPath. ' Den kan redigeres ved hjælp af Microsoft InfoPath. Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup AddHandler DirectCast(EventManager.ControlEvents("SaveAs"), ButtonEvent).Clicked, AddressOf SaveAs_Clicked End Sub Public Sub SaveAs_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs) Dim Xdocument As System.Configuration.Configuration Xdocument.SaveAs(("C:\")) End Sub End Class End Namespace It's a test form where I only have one button just to check the funktionality
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.