5307.html

来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 27 行

HTML
27
字号
<html>
  <head>
    <title>Re: 到上一层目录 如何做 ?</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 到上一层目录 如何做 ?</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by <a href="mailto:honey0@tcts1.seed.net.tw">Honey</a> on September 05, 1998 at 21:55:54:<p>
In Reply to: <a href="5306.html">到上一层目录 如何做 ?</a> posted by Shelby on September 05, 1998 at 19:30:39:<p>
不记得有类是的函数<br>我有写个成函数 可以找出路径<br>我用的方法是用 '\' 判别<p>Function ExtractPath$(sSpecIn$)<p>  Dim nCnt As Integer, sSpecOut As String<br>  <br>  On Local Error Resume Next<p>  If InStr(sSpecIn, "\") Then<br>  '/*检查是否有"\"字串 非零表示成立*/<br>    For nCnt = Len(sSpecIn) To 1 Step -1<br>    '/*从后面开始比对*/<br>      If Mid$(sSpecIn, nCnt, 1) = "\" Then<br>        sSpecOut = Left$(sSpecIn, nCnt)<br>        '/*从字串开头取到最后一个 "\" 字串*/<br>        Exit For<br>      End If<br>    Next nCnt<br>  <br>  ElseIf InStr(sSpecIn, ":") = 2 Then<br>    sSpecOut = CurDir$(sSpecIn)<br>    If Len(sSpecOut) = 0 Then sSpecOut = CurDir$<p>  Else<br>    sSpecOut = CurDir$<br>    '传回目前磁碟机的路径<br>  End If<br>    <br>  If Right$(sSpecOut, 1) <> "\" Then<br>    sSpecOut = sSpecOut + "\"<br>  End If<br>  <br>  ExtractPath$ = UCase$(sSpecOut)<p>End Function<p>使用方法是这样<br>dim g as string,d as string <br>g=app.path<br>d=ExtractPath$(g)<br>'/*d 就是应用程式所在目录的 _<br>上一层的目录*/<p>: 请问   <br>:         错的程式码 :<br>:                  dbName = App.Path + "/" + "DataBase" + "\" + txtDbName.Text + ".mdb"<br>:        我想到上一层目录, 如何做 ?<p>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 5307-->
<!--top: 5339--><li><a href="5339.html">加个 ..\ 就可以了</a> <b>小吴</b> <i>07:28:59 9/07/98</i>
(<!--responses: 5339-->0)
<ul><!--insert: 5339-->
</ul><!--end: 5339-->
</ul><!--end: 5307-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?