重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
用两个小数点表示,比如上级目录的abc子目录: ..\abc
为察隅等地区用户提供了全套网页设计制作服务,及察隅网站建设行业解决方案。主营业务为做网站、成都网站制作、察隅网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
一个小数点则表示当前目录,比如当前目录的abc子目录: .\abc ,当然也可以直接 abc
Public Function getParent(path As String) As String
If Right(path, 2) = ":\" Then '判读是否已经是根目录
getParent = ""
Exit Function
End If
If Right(path, 1) = "\" Then '去除最后一个\
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
给你一段我曾经写的代码,主要是生成TreeView的节点!有什么不懂的地方你就提!
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)
'添加根节点
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)
'添加树结构第二层
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