在VB 6.0和SQL作的数据库中,我想用RichTextBox控件 OLE控件来显示文本文档或WORD文档,因为VB系统做完后存在打包问题,需要在其他电脑运行,所以文件路径需要用相对路径,但是怎么设置都不行,以下几种方法都说不对,多多指教,谢谢!
RichTextBox1.FileName = App.Path & "/快捷键0 .txt"
RichTextBox1.FileName =" App.Path & "/快捷键0.txt""
RichTextBox1.FileName='App.Path & "\"& 快捷键0.txt

解决方案 »

  1.   

    Public Function AddBackslash(ByVal Path As String) As StringDim Delimiter   As String   ' segmented path delimiter    If InStr(Path, "://") > 0 Then          ' it's a URL path
            Delimiter = "/"                     ' use URL path delimiter
        Else                                    ' it's a disk based path
            Delimiter = "\"                     ' use disk based path delimiter
        End If    Select Case Right$(Path, 1)             ' whats last character in path?
        Case "/", "\"                           ' it's one of the valid delimiters
            AddBackslash = Path                ' use the supplied path
        Case Else                               ' needs a trailing path delimiter
            AddBackslash = Path & Delimiter    ' append it
        End SelectEnd FunctionRichTextBox1.FileName=AddBackslash(App.Path) & 快捷键0.txt
      

  2.   

    RichTextBox1.FileName=AddBackslash(App.Path) & "快捷键0.txt"