您的位置:程序门 -> vb -> 控件



richtextbox控件 ole控件中文件路径的设置问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


richtextbox控件 ole控件中文件路径的设置问题
发表于:2007-08-11 13:15:03 楼主
在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
发表于:2007-08-11 15:35:041楼 得分:0
public   function   addbackslash(byval   path   as   string)   as   string

dim   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   select

end   function

richtextbox1.filename=addbackslash(app.path)   &   快捷键0.txt

发表于:2007-08-11 15:36:472楼 得分:0
richtextbox1.filename=addbackslash(app.path)   &   "快捷键0.txt "
发表于:2007-08-11 18:37:243楼 得分:0
谢谢指教,按照你前面的方法,还是不行,说是“不能访问指定路径或文件名,或是无效的”


快速检索

最新资讯
热门点击