Opening XML File

I want to open an xml file on my desktop application. The “FileType” code is really giving me some issues as I do not understand this part of the code at all.

FileOpen Code:

[code] Dim dlg As OpenDialog
Dim f As FolderItem
dlg = New OpenDialog

dlg.InitialDirectory = SpecialFolder.Desktop

dlg.title = “Select a file from ________________ to upload” // Text removed for security reasons

dim Type as FileType

Type.Extensions = “xml;.xml”

dlg.filter = Type.Extensions[/code]

You either need to define the FileType at the project level, (i.e. Add New File Type - e.g. FileTypes1, and define the XML File Type using the FileType editor). Or you need to define the FileType in code (see example below).

From LR:

Dim jpegType as New FileType jpegType.Name = "image/jpeg" jpegType.MacType = "JPEG" jpegType.MacCreator="prvw" jpegType.Extensions = "jpg;jpeg"

Possible example for XML:

Dim xmlType as New FileType xmlType.Name = "text/xml" xmlType.MacType = "XML" xmlType.Extensions = "xml"

possible use:

dlg.Filter = xmlType

[quote=178836:@LangueR]

Possible example for XML:

Dim xmlType as New FileType xmlType.Name = "text/xml" xmlType.MacType = "XML" xmlType.Extensions = "xml"

possible use:

dlg.Filter = xmlType

Both of these worked great! Thank you!