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



救救啊!!!!!!!


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


救救啊!!!!!!!
发表于:2007-03-15 16:07:12 楼主
1:首先去读文件.文件里面的数据是
^[1;3h1
^[2;3h2
^[4;3h4
^[5;3h5
^[6;3h6
^[7;3h7
^[8;3h8
^[9;3h9
^[10;2h10
^[11;2h11
^[17;2h17
^[18;2h18
^[19;2h19
^[20;2h20)
****[1
        [2
        [3
          等等!1,2,3...代表的是行数,
****h1
        h2
        h3
          等等!1,2,3...代表的是值
程序运行的时候窗体中打印出   1   ,2   ,3   但是这个值是按行走的!
    效果应该是:
          1
          2
          3
         
          4
          5
         
         
        17
        18
        19
        20
  谢谢了!   这些值是h后面的值
发表于:2007-03-15 17:38:071楼 得分:0
private   sub   command1_click()
        dim   strm   as   textstream
        dim   fs   as   new   filesystemobject
        dim   stmp   as   string
        dim   fl   as   file
        set   fl   =   fs.getfile( "d:\aa.txt ")
        set   strm   =   fl.openastextstream(forreading)
        s   =   1
        do   while   strm.atendofline   =   false
                stmp   =   strm.readline
                stmp   =   mid(stmp,   3)
                h   =   val(stmp)
                v   =   mid(stmp,   instr(stmp,   "h ")   +   1)
                do   while   h   >   s
                        print   " "
                        s   =   s   +   1
                loop
                print   v
                s   =   s   +   1
        loop
        strm.close
end   sub
发表于:2007-03-15 17:44:242楼 得分:0
用split对h分组
发表于:2007-03-15 17:51:333楼 得分:0

  dim   fname   as   string
  dim   str   as   string
       
        fname   =   app.path   &   "\test.txt "

        open   fname   for   input   as   #1
        do   while   not   eof(1)
                line   input   #1,   str
                debug.print   val(split(str,   "h ")(1))
        loop
        close   #1


快速检索

最新资讯
热门点击