Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2010 VB2010 OpenFileDialog filepath problem

$
0
0
Hello all,

I have a problem opening file with "OpenFileDialog" from a location which uses special characters of our language.

If I use filepath like follows: "D:\PROJEKTI\Velenje\TEOVS\ČP v VH Mravljakov vrh (2.2.10)\Program\CPinVH_MravljakovVrh_Run.tws", I get HRESULT error: Error HRESULT E_FAIL has been returned from a call to a COM component.

If I change filepath like this: "D:\PROJEKTI\Velenje\TEOVS\CP v VH Mravljakov vrh (2.2.10)\Program\CPinVH_MravljakovVrh_Run.tws", everything works OK.

the only difference is in character "Č" and "C".

My code:
Code:

        Dim TWSDoc As TWinSoft.Document = New TWinSoft.Document
        Dim f As System.Runtime.InteropServices.ComTypes.IPersistFile = DirectCast(TWSDoc, System.Runtime.InteropServices.ComTypes.IPersistFile)
        Dim pot As String

        OpenFileDialog2.Filter = "TWinSoft files *.tws| *.tws"
        If OpenFileDialog2.ShowDialog = Windows.Forms.DialogResult.OK Then
            pot = OpenFileDialog2.FileName
            f.Load(pot, 0) ' --> Here I get error
        Else
            Exit Sub
        End If


Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>