I want to add an xml file to the Add-in files list along with my dll. So that I can read some data from the xml file. But how do I read that xml file? How do I get the path of the xml file?
Thanks in advance.
If you want to include a specific XML file just add it to the project (and set the property copy to output directory to copy always)
you can find where your assembly is running from by getting it from the assembly like this:
Dim thisAssembly As Assembly
Public installDir As String
installDir = System.IO.Path.GetDirectoryName(thisAssembly.Location)
You can use System.XmlL and System.Xml.Linq library commands to read the file.
Check this out
or you can google it out - there is nothing to do with SW API
you can easily convert an xml file to a dataset.
Function GetDatasetFromXML(ByVal XMLFileName As String) As DataSet
Dim RetDs As DataSet = Nothing
If Len(Trim(XMLFileName)) > 0 Then
If My.Computer.FileSystem.FileExists(XMLFileName) = True Then
RetDs = New DataSet
Dim ConstEnforced As Boolean = RetDs.EnforceConstraints
RetDs.EnforceConstraints = False
If IsNothing(RetDs) = False AndAlso RetDs.Tables.Count = 0 Then
RetDs = Nothing
If IsNothing(RetDs) = False Then
RetDs.EnforceConstraints = ConstEnforced
Yes GetAssembly is what I am looking for. Thanks for the quick replies guys.
Retrieving data ...