Private Sub Form_Load()
With ListView1
With .ColumnHeaders
.Add , , "省/自治区/直辖市", ListView1.Width / 3
.Add , , "地区/市", ListView1.Width / 3
.Add , , "区/县", ListView1.Width / 3
End With
End With
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
'listview 设置
Dim CurListitem As ListItem
Dim fname As String
Dim sname As String
Dim tname As String
|—— fname =
|—— sname =
|—— tname =
With ListView1
With .ListItems
Set CurListitem = .Add(, , fname)
CurListitem.SubItems(1) = sname
CurListitem.SubItems(2) = tname
End With
End With
Set CurListitem = Nothing
End Sub各位大虾:我现在想在fname里显示省名,在第二栏sname里显示市名,在第三栏tname里显示区县。
也就是把node.fullpath分开来显示。
还有怎么样通过双击来删除listview里的单条项目。
With ListView1
With .ColumnHeaders
.Add , , "省/自治区/直辖市", ListView1.Width / 3
.Add , , "地区/市", ListView1.Width / 3
.Add , , "区/县", ListView1.Width / 3
End With
End With
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
'listview 设置
Dim CurListitem As ListItem
Dim fname As String
Dim sname As String
Dim tname As String
|—— fname =
|—— sname =
|—— tname =
With ListView1
With .ListItems
Set CurListitem = .Add(, , fname)
CurListitem.SubItems(1) = sname
CurListitem.SubItems(2) = tname
End With
End With
Set CurListitem = Nothing
End Sub各位大虾:我现在想在fname里显示省名,在第二栏sname里显示市名,在第三栏tname里显示区县。
也就是把node.fullpath分开来显示。
还有怎么样通过双击来删除listview里的单条项目。
fname = v(0)
sname = v(1)
tname = v(2)
v=split(node.fullpath,treeview1.PathSeparator)
fname = v(0)
sname = v(1)
tname = v(2)
可当我点击上一级目录的时候就出现下标越界的错误
我想实现当我点击上一级目录时就显示fname,sname,
而tname 就为空~
怎么解决阿?
谢谢还有怎样删除listview里单条的行啊?
expression包含子字符串和分隔符的字符串表达式
delimiter用于标识子字符串边界的字符串字符
当鼠标点末字节的时候,
TreeView1.PathFull为全国\江苏省\无锡市\惠山区
V的返回值有4个v(0)=全国,V(1)=江苏省,V(2)=无锡市,V=(3)=惠山区
这时候是合法的
当我点非末节点的时候
TreeView1.PathFull为全国\江苏省\无锡市
V的返回值只有3个,v(0)=全国,V(1)=江苏省,V(2)=无锡市
这样V(3)就下标出界