本文向大家展示了listview控件在report视图下任何列头的双向排序技巧,源代码如下
option explicit
private sub form_load()
dim i as integer
dim itemx as listitem
listview1.view = lvwreport
with listview1.columnheaders
.add , , "编号", 600, lvwcolumnleft
for i = 1 to 2
.add , , "内容项" & i, 1000, lvwcolumnright
next
end with
with listview1.listitems
for i = 1 to 10
set itemx = .add
itemx.subitems(1) = i
itemx.subitems(2) = chr(64 + i)
itemx.subitems(3) = format(dateadd("m", i, date), "yyyy-mm-dd")
next
end with
end sub
private sub listview1_columnclick(byval columnheader as mscomctllib.columnheader)
with listview1
if (columnheader.index - 1) = .sortkey then
.sortorder = (.sortorder + 1) mod 2
else
.sorted = false
.sortorder = 0
.sortkey = columnheader.index - 1
.sorted = true
end if
end with
end sub
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器