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



print 输出时会占用资源吗


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


print 输出时会占用资源吗
发表于:2007-05-25 18:36:01 楼主
我用vb6.0   见sql2000写了一个实时显示数据的程序,屏幕输出是用print输出的,
    代码如下:   timer1   用来控制屏幕显示和刷新的,lm02是个下拉列框,用来选着显示的组别,但我每次选下拉条目时,显示过程中,我关闭窗体都没有响应,是怎么回事呀.

private   sub   timer1_timer()

  timer1.interval   =   11000
    cls
    currenty   =   100
    print

    dim   i   as   integer
    dim   j   as   integer
    dim   time_start,   time_end
   
   
set   rs   =   new   adodb.recordset
    on   error   resume   next
   
  with   rs
          .activeconnection   =   conn
          .cursorlocation   =   aduseclient
          .cursortype   =   adopenkeyset
          .locktype   =   adlockoptimistic
          .open   "select   *,left(lm05,19)lm05part1,isnull(substring(lm05,20,26), '   ')   lm05part2   from   lmp "   _
                  &   "   where   lm01   like   ' "   &   trim(lm01.caption)   &   "% 'and   lm06= ' "   &   trim(lm06.caption)   &   " ' "   _
                  &   "group   by   lm01,lm02,lm03,lm06,lm04,lm05,lm07,lm08,lm09,lm10,lm11,lm12,lm13,lm14,lm15,lm16,lm17,lm18,lm19 "
  end   with
 

  i   =   0
 
if   rs.eof   =   true   then   'èç¹ûµ±ç°×é±ðµä¼çâ¼îª¿õ,µè´ý3ãë½øèëïâò»¸ö×é±ð

       
        set   rs   =   nothing
        timer1.interval   =   3000
      exit   sub
     
  else
 
          rs.movefirst
         
end   if


'êä³öêý¾ý

do   while   rs.eof   =   false
 
if   i   >   6   then     '   ò»´îêä³ö7ìõêý¾ýê±,   µè´ý11ãëôùë¢ðâïôê¾ïâãæµä¼çâ¼

            time_start   =   time
            time_end   =   dateadd( "s ",   "11 ",   time_start)
         
delay:
          lbltimer.caption   =   datediff( "s ",   time,   time_end)
         
          if   lbltimer.caption   =   0   then
             
              i   =   0
              cls
              currenty   =   100
              print
   
            else
                goto   delay
        end   if
     
end   if

  font.size   =   17
  font.bold   =   true
  print   tab(1);   rs!lm04;   tab(12);   rs!lm08;   tab(23);   rs!lm09;   tab(32);   rs!lm11;   tab(42);   rs!lm13;   tab(52);   rs!lm15;   tab(61);   rs!lm17,
  print   tab(1);   rs!lm05part1;   tab(23);   rs!lm10;   tab(32);   rs!lm12;   tab(42);   rs!lm14;   tab(52);   rs!lm16;   tab(61);   rs!lm18;   tab(71);   rs!lm19,
  print   tab(1);   rs!lm05part2
 
  if   i   <   7   then
      print   "-------------------------------------------------------------------------------------------------------------------- "
  end   if
 
  rs.movenext
  i   =   i   +   1
 
loop

 
  '&micro;±&ograve;&raquo;&cedil;&ouml;×é±&eth;&micro;&auml;&frac14;&ccedil;&acirc;&frac14;&iuml;&ocirc;&ecirc;&frac34;&iacute;ê&ograve;&ocirc;&ordm;ó,&micro;&egrave;&acute;&yacute;11&atilde;&euml;&frac12;&oslash;&egrave;&euml;&iuml;&acirc;&ograve;&raquo;&cedil;&ouml;×é±&eth;&micro;&auml;&iuml;&ocirc;&ecirc;&frac34;
if   rs.eof   =   true   then
 
      time_start   =   time
      time_end   =   dateadd( "s ",   "11 ",   time_start)
delaytow:
            lbltimer.caption   =   datediff( "s ",   time,   time_end)
           
        if   lbltimer.caption   =   0   then
             
                i   =   0
                cls
                currenty   =   100   '&para;¨&icirc;&raquo;&ecirc;&auml;&sup3;&ouml;&icirc;&raquo;&ouml;&atilde;
                print
 
           
            timer1.interval   =   3000
            exit   sub
      else
              goto   delaytow
 
    end   if
    set   rs   =   nothing
   
end   if
   
end   sub

发表于:2007-05-25 21:42:561楼 得分:0
程序结构不赞同
发表于:2007-05-26 08:50:062楼 得分:0
请指教呀.如何写滚动刷新方面的程序.
发表于:2007-05-28 14:00:473楼 得分:0
可以这样:
使用text控件,mutiline属性设位true,scrollbars属性设位3
然后将原来要输出在屏幕上的内容输出到text上就可以了

当然,还可以用richtext控件


快速检索

最新资讯
热门点击