您的位置:程序门 -> vb -> 基础类



菜鸟小问题


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


菜鸟小问题[已结贴,结贴人:helloworld520]
发表于:2007-03-03 14:21:18 楼主
一个按钮,叫做“新增”,点击第一次,执行下面语句:
      for   a   =   0   to   15
            text3(a).visible   =   true
      next   a
点击第二次,执行下面语句:
      for   a   =   0   to   15
            text4(a).visible   =   true
      next   a
同理类推。
另外一个按钮,叫做“删除”点击第一次,执行下面语句:
      for   a   =   0   to   15
            text4(a).visible   =   false
      next   a
点击第二次,执行下面语句:
      for   a   =   0   to   15
            text3(a).visible   =   false
      next   a
同理类推

请高手帮忙
发表于:2007-03-03 14:21:501楼 得分:0
自己顶一下
发表于:2007-03-03 14:38:372楼 得分:0
再顶一下
发表于:2007-03-03 14:53:203楼 得分:20
option   explicit
        dim   cmd1flag   as   boolean
        dim   cmd2flag   as   boolean
        dim   i   as   byte
private   sub   command1_click()
        if   cmd1flag   then
                for   i   =   0   to   3
                        text4(i).visible   =   true
                next
        else
                for   i   =   0   to   3
                        text3(i).visible   =   true
                next
        end   if
cmd1flag   =   not   cmd1flag
end   sub

private   sub   command2_click()
        if   cmd2flag   then
                for   i   =   0   to   3
                        text4(i).visible   =   false
                next
        else
                for   i   =   0   to   3
                        text3(i).visible   =   false
                next
        end   if
        cmd2flag   =   not   cmd2flag
end   sub

private   sub   form_load()
        for   i   =   0   to   3
                text3(i).visible   =   false
                text4(i).visible   =   false
        next
end   sub
发表于:2007-03-03 15:00:364楼 得分:10
测试环境准备
text1(0)   text1(1)
text2(0)   text2(1)
text3(0)   text3(1)
command(0)====增加   command(1)===减少

增加一个class   名字为class1
代码如下
option   explicit


public   sub   funtxt1(i   as   integer,   view   as   boolean)
        dim   intx   as   integer
        for   intx   =   0   to   i   -   1
              form1.text1(intx).visible   =   view
        next
end   sub

public   sub   funtxt2(i   as   integer,   view   as   boolean)
        dim   intx   as   integer
        for   intx   =   0   to   i   -   1
              form1.text2(intx).visible   =   view
        next
end   sub

public   sub   funtxt3(i   as   integer,   view   as   boolean)
        dim   intx   as   integer
        for   intx   =   0   to   i   -   1
              form1.text3(intx).visible   =   view
        next
end   sub


窗体代码如下
option   explicit
dim   intadd   as   integer
dim   intdec   as   integer
private   sub   command1_click(index   as   integer)
        dim   myclass   as   new   class1
       
      select   case   index
                    case   0
                          call   callbyname(myclass,   "funtxt "   &   intadd,   vbmethod,   2,   true)
                          intadd   =   (intadd   +   1)
                          if   intadd   =   4   then   intadd   =   1
                    case   1
                          call   callbyname(myclass,   "funtxt "   &   intdec,   vbmethod,   2,   false)
                          intdec   =   (intdec   -   1)
                          if   intadd   =   -1   then   intadd   =   3
        end   select
                         
end   sub

         
private   sub   form_load()
    dim   i   as   integer
    for   i   =   0   to   1
        text1(i).visible   =   false
        text2(i).visible   =   false
        text3(i).visible   =   false
    next
    intadd   =   1
    intdec   =   3
end   sub

经过调试!!!!!
发表于:2007-03-03 15:53:145楼 得分:0
option   explicit
dim   j   as   integer
private   sub   command1_click()
static   i   as   integer
i   =   i   +   1
if   i   =   1   then
for   j   =   0   to   15
text1(j).visible   =   true
next
elseif   i   =   2   then
for   j   =   0   to   15
text2(j).visible   =   true
next
elseif   i   > =   3   then
i   =   i   -   3
for   j   =   0   to   15
text3(j).visible   =   true
next
end   if
end   sub

private   sub   command2_click()
static   i   as   integer
i   =   i   +   1
if   i   =   1   then
for   j   =   0   to   15
text1(j).visible   =   false
next
elseif   i   =   2   then
for   j   =   0   to   15
text2(j).visible   =   false
next
elseif   i   > =   3   then
i   =   i   -   3
for   j   =   0   to   15
text3(j).visible   =   false
next
end   if
end   sub


快速检索

最新资讯
热门点击