您的位置:程序门 -> vb ->



点击控件次数


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


点击控件次数[已结贴,结贴人:wjp1015]
发表于:2007-10-16 16:04:24 楼主
private   sub   listview1_columnclick(byval   columnheader   as   columnheader)  
       
        listview1.sortorder   =   0       '设为升序
       
            listview1.sortkey   =   columnheader.index   -   1               '       设置点击的column为排序的依据
       
                listview1.sorted   =   true   '开始排序
       
    end   sub
我想点一次按升序排,再点次按降序排,怎么实现?愿听详解,谢谢了
发表于:2007-10-16 16:14:411楼 得分:2
简单的方法就是声明一个boolean变量
发表于:2007-10-16 16:18:402楼 得分:0
不好意思,本人新手,你能说得更详细一些么??谢谢了
发表于:2007-10-16 16:18:523楼 得分:6
pubilc   i
form   中i=0


if   i=0   then
  listview1.sortorder   =   0         '设为升序  
         
            listview1.sortkey   =   columnheader.index   -   1                 '       设置点击的column为排序的依据  
         
                listview1.sorted   =   true     '开始排序  
    i=1
else
  listview1.sortorder   =   1         '设为   jaing   序  
         
            listview1.sortkey   =   columnheader.index   -   1                 '       设置点击的column为排序的依据  
         
                listview1.sorted   =   true     '开始排序  
i=0
end   if
发表于:2007-10-16 16:20:114楼 得分:6
dim   chenjl1031   as   boolean      
chenjl1031=true  

private   sub   listview1_columnclick(byval   columnheader   as   columnheader)    
            if   chenjl1031   then        
                  listview1.sortorder   =   0         '设为升序
                    chenjl1031=false
              else
                  listview1.sortorder   =   1         '设为降序
                    chenjl1031=true  
            endif      
              listview1.sortkey   =   columnheader.index   -   1                 '       设置点击的column为排序的依据  
              listview1.sorted   =   true     '开始排序  
end   sub  
发表于:2007-10-16 16:32:205楼 得分:6
窗体变量:
dim   chenjl1031   as   boolean        
chenjl1031=true    

过和中
private   sub   listview1_columnclick(byval   columnheader   as   columnheader)      
        chenjl1031=not   chenjl1031
        if   chenjl1031   then          
                listview1.sortorder   =   0           '设为升序  
          else  
                listview1.sortorder   =   1           '设为降序      
        endif        
        listview1.sortkey   =   columnheader.index   -   1                   '       设置点击的column为排序的依据    
        listview1.sorted   =   true       '开始排序    
end   sub    
发表于:2007-10-16 16:55:516楼 得分:0
都谢谢大家了!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~问题解决了,不过得一更好解,和大家分享
  private   sub   listview1_columnclick(byval   columnheader   as   columnheader)
       
            listview1.sortorder   =   1   -   listview1.sortorder
       
            listview1.sortkey   =   columnheader.index   -   1               '       设置点击的column为排序的依据
       
            listview1.sorted   =   true   '开始排序
       
    end   sub
发表于:2007-10-16 17:05:037楼 得分:0
:)


快速检索

最新资讯
热门点击