用兩個(gè)小數(shù)點(diǎn)表示,比如上級(jí)目錄的abc子目錄: ..\abc
為察隅等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及察隅網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為做網(wǎng)站、成都網(wǎng)站制作、察隅網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!
一個(gè)小數(shù)點(diǎn)則表示當(dāng)前目錄,比如當(dāng)前目錄的abc子目錄: .\abc ,當(dāng)然也可以直接 abc
Public?Function?getParent(path?As?String)?As?String
If?Right(path,?2)?=?":\"?Then?'判讀是否已經(jīng)是根目錄
getParent?=?""
Exit?Function
End?If
If?Right(path,?1)?=?"\"?Then?'去除最后一個(gè)\
path?=?Left(path,?Len(path)?-?1)
End?If
path?=?Left(path,?InStrRev(path,?"\")?-?1)?'取父目錄
If?Right(path,?1)?=?":"?Then
path?=?path?+?"\"
End?If
getParent?=?path
End?Function
給你一段我曾經(jīng)寫(xiě)的代碼,主要是生成TreeView的節(jié)點(diǎn)!有什么不懂的地方你就提!
Public Sub InitializeTreeView(ByVal strvXL As TreeView, ByVal vrsRecordTwo As DataSet)
Dim treBaseNodeOne As TreeNode
Dim treBaseNodeTwo As TreeNode
Dim strDWDM As String
m_rsRecordTwo = g_clsSybase.SelectSC_PD_SBCSB1()
'查找供電局信息
g_clsSybase.SelectRS_ZZJG_ZZJGDMB(m_rsRecordOne)
'添加根節(jié)點(diǎn)
Do While m_rsRecordOne.Read
strDWDM = m_rsRecordOne.GetString(0) '獲取單位代碼
treBaseNodeOne = New TreeNode
treBaseNodeOne.Text = m_rsRecordOne.GetString(1).Trim() '獲取單位名稱
treBaseNodeOne.Name = m_rsRecordOne.GetString(1)
treBaseNodeOne.Tag = ""
strvXL.Nodes.Add(treBaseNodeOne)
'添加樹(shù)結(jié)構(gòu)第二層
Dim drsTwo() As DataRow
drsTwo = m_rsRecordTwo.Tables(0).Select("SSDW='" strDWDM "' and SC__XLBM is null")
For Each dr As DataRow In drsTwo
treBaseNodeTwo = New TreeNode
treBaseNodeTwo.Text = dr.Item("XLMC").ToString.Trim
treBaseNodeTwo.Name = dr.Item("XLMC")
treBaseNodeTwo.Tag = dr.Item("XLBM")
treBaseNodeOne.Nodes.Add(treBaseNodeTwo)
Next
Loop
m_rsRecordOne.Close()
End Sub