For Windows XP you can use UserAccounts.CommonDialog object, see documentation for more details but in short it's something like this: Set dlg = CreateObject('UserAccounts.CommonDialog') dlg.InitialDir = CreateObject('WScript.Shell').SpecialFolders('MyDocuments') dlg.Filter = 'XML files *.xml' If dlg.ShowOpen 0 Then Set xmlDoc = CreateObject('Msxml2.DOMDocument') xmlDoc.load(dlg.FileName) ' Your code End If Note that I'm also using WScript.Shell object to get user's documents folder (so you don't have to hard-code it). I'd suggest to do same thing also for output file. Unfortunately this object has been removed in Windows 7 (maybe because of security issues) then you have to use something else. There are many candidates, let's see some of them.

Openfiledialog Xml File C#

Easier method is to use comdlg32.dll like this: Set dlg = CreateObject('MSComDlg.CommonDialog.1') dlg.InitialDir = CreateObject('WScript.Shell').SpecialFolders('MyDocuments') dlg.Filter = 'XML files *.xml' This DLL seems to don't be registered on every system, if this is your case you have to in c: windows system32 and register COM objects with regsrv32. A decent alternative is to use Shell object (explore its methods on ): Set dlg = CreateObject('Shell.Application') Set selectedFile = objShell.BrowseForFolder(0, 'XML file:', &H00004000&, 'C: ') If Not selectedFile Is Nothing Then Set xmlDoc = CreateObject('Msxml2.DOMDocument') xmlDoc.load(selectedFile.Self.Path) End If That isn't a true open file dialog but a browse for folder dialog with files, better solution is to use, code is longer so please refer to for full source and details. In short you have to import that function: Declare Function GetOpenFileName Lib 'comdlg32.dll' Alias 'GetOpenFileNameA' (OFN As OPENFILENAME) As Boolean You may also want to take a look to, it handles most of tricky cases (yes such simple task isn't finally so simple!!!).

Those examples dont explain my problem. They are 1 step further. I can figure out the 'parsing'.

OpenFileDialog filename serialization. But it does not serialize to the xml file. But the OpenFileDialog control must change the current operating directory. FileDialog.Filter Property.NET. Gets or sets the current file name. The following code example uses the OpenFileDialog implementation of FileDialog.

But first I have to get my XML stream in the right format. Star Ocean The Second Story Save Game Files. Like your 2nd example begins with XDocument document = XDocument.Load( 'MapImages.xml'); I have trouble converting the data from my OpenFileDialog to XDocument. There is Stream, Filestream, Stringreader, Streamreader, XMLReader.

For the OpenFileDialog I can call it like this myOpenFiledialog.OpenRead() (this gives IO.Stream) myOpenFileDialog.OpenText() (this gives type Streamreader). Frank Ribery Theme For Windows 7 For Free Nomad Jukebox Zen Extra Driver Software. here.

Coments are closed
Scroll to top