cancel
Showing results for 
Search instead for 
Did you mean: 

Reg Error in form Load

Former Member
0 Kudos

Hi All,

When i trying to load a form thru the folowing code i am getting the error . The error message is

<b>"Object Reference not set to an instance of an object" </b>

Private Sub LoadFromXML(ByRef FileName As String)

Try

Dim oXmlDoc As Xml.XmlDocument

oXmlDoc = New Xml.XmlDocument

'// load the content of the XML File

Dim sPath As String

sPath = IO.Directory.GetParent(Application.StartupPath).ToString

oXmlDoc.Load(sPath & "\Forms\" & FileName)

'// load the form to the SBO application in one batch

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End Sub

So what can i do on this?

Pl somebody can help me on this to solve

Regards

Suresh R

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi suresh,

In statement

SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)

u have pass the oXmlDoc.InnerXml. this is wrong with ur code. u have to pass the reference of xml string.

oXmlDoc.Load( sPath + "
" + FileName );

// load the form to the SBO application in one batch

string sXML = oXmlDoc.InnerXml.ToString();

SBO_Application.LoadBatchActions(ref sXML);

hope this will help u.

if satisfied, rewards points

regards

nirdesh panwar

Answers (2)

Answers (2)

Former Member
0 Kudos

Hai Suresh

I think u trying to load the xml file so,

Try this,

Sub AddXML(ByVal pathstr As String)

Try

Dim xmldoc As New MSXML2.DOMDocument

Dim stream As System.IO.Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("<ProjectName>." + pathstr)

Dim streamreader As New System.IO.StreamReader(stream, True)

xmldoc.loadXML(streamreader.ReadToEnd())

streamreader.Close()

app.LoadBatchActions(xmldoc.xml)

Catch ex As Exception

'app.MessageBox(ex.Message)

End Try

End Sub

Regards,

Anitha

Eneveux
Product and Topic Expert
Product and Topic Expert
0 Kudos

Suresh,

Have a look at the sample code that is part of the Business One SDK and see if your code is similar.

..\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\04.WorkingWithXML

Eddy