Results 1 to 2 of 2

Thread: VB2010 OpenFileDialog filepath problem

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    38

    VB2010 OpenFileDialog filepath problem

    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

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: VB2010 OpenFileDialog filepath problem

    I would venture to suggest that the problem is not with the Dialog which can handle Č perfectly well but with your assumption that the directory name contains the special character. If it works with C, that is because that's the character that is actually there.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width