像这种前面有个小窗口的是什么噢
MSFHLEXGRID能实现不连续的多选,然后进行多选删除嘛?

解决方案 »

  1.   

    应该是 ListView 控件吧。
      

  2.   

    也不是不能, 要实现这个也很简单.
    所谓多选单选,无非就是你的程序能够知道那些是你"选过的"那些是你"没有选过的"
    GRID有固定列, 鼠标点某一行,在这一行的最作面的固定列上作个标记,比如加个"*"什么的. 如果已经有"*"就把它去掉.
    这样不就把选中和未选中的区别开了么.
    至于你要删除也好添加也好,只要扫描每行的第一列是否有标记就完啦.
      

  3.   

    可以用cellpicture属性放上复选框样子的图片
    可以用rowdata属性标记哪行被选中
      

  4.   

    '也可以在mshflexgrid上增加一列,当单击某一行是此列为选中状态,再单击时为未选中状态,然后循环mshflexgrid,根据此列来判断作处理
    '选择行的代码:
    Private Sub mshflexgrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        with mshflexgrid1
             '假设第0列为选择标志列
           if trim(.textmatrix(.row,0))="" then
               .textmatrix(.row,0)="√"
           else
               .textmatrix(.row,0)=""
           end if
        end with
    end sub'根据选择行作处理的代码:
    private sub command1_click()
        dim i as long 
        with mshflexgrid1
            for i=1 to .rows-1
                if trim(.textmatrix(i,0))="√" then
                    conn.execute "..."    '这里加入处理语句
                  end if
            next i
        end with
    end sub
      

  5.   

    '也可以在mshflexgrid上增加一列,当单击某一行是此列为选中状态,再单击时为未选中状态,然后循环mshflexgrid,根据此列来判断作处理
    '选择行的代码:
    Private Sub mshflexgrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        with mshflexgrid1
             '假设第0列为选择标志列
           if trim(.textmatrix(.row,0))="" then
               .textmatrix(.row,0)="√"
           else
               .textmatrix(.row,0)=""
           end if
        end with
    end sub'根据选择行作处理的代码:
    private sub command1_click()
        dim i as long 
        with mshflexgrid1
            for i=1 to .rows-1
                if trim(.textmatrix(i,0))="√" then
                    conn.execute "..."    '这里加入处理语句
                  end if
            next i
        end with
    end sub这样子做了,可以标记勾号的。
    但是删除的时候。好像都还是只删除选中的最后一条。。
      

  6.   

    using cycle to handle it
      

  7.   

    using cycle to handle it?
    是在这里conn.execute "..."    '这里加入处理语句 
    加入以日期为条件的语句嘛?
    是这样的话试过了也一样的
      

  8.   

    "delete * from A where time=#" & fg.TextMatrix(fg.Row, 4) & "#" 
     按时间删除语句。。
    "delete * from A where id=" & fg.TextMatrix(fg.Row, 10)
    按ID列表删除
      

  9.   

    '你的语句中fg.row表示当前行的值,而非选中行的对应值,语句应该改为:
    '根据选择行作处理的代码: 
    private sub command1_click() 
        dim i as long 
        with mshflexgrid1 
            for i=1 to .rows-1 
                if trim(.textmatrix(i,0))="√" then 
                    'conn.execute "delete * from A where id=" & fg.TextMatrix(fg.Row, 10) &"
                       conn.execute "delete * from A where id=" & fg.TextMatrix(i, 10) &"
                  end if 
            next i 
        end with 
    end sub 
      

  10.   

    这样子是可以删除了,不过有个问题。单击的时候为不选。再单击为选中,这个怎么回事。。
           .textmatrix(.row,0)=""
           else
               .textmatrix(.row,0)="√"
    我把勾号换在下面,会出现单击选中。再单击还是选中
      

  11.   

    如果表里有一个MONEY字段 数字字段来的,如果这样子能统计选中的记录的MONEY总数显示在TEXT1上面嘛?
      

  12.   

    '把这个数字字段的内容也显示在mshflexgrid1控件中,比如为第5列,选中某行时将此行的第5列内容累加到text1控件中,取消选中时从text1控件中扣减第5列内容:
    Private Sub mshflexgrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 
        with mshflexgrid1 
            '假设第0列为选择标志列 
          if trim(.textmatrix(.row,0))="" then 
              .textmatrix(.row,0)="√" 
              '选中后将第5列的内容累加到text控件中
              if trim(.textmatrix(.row,5))<>"" then
                  text1.text=format(cdbl(text1.text)+cdbl(.textmatrix(.row,5),"standard")
              end if
          else 
              .textmatrix(.row,0)="" 
              '取消选中后将第5列的内容从text1中扣减
              if trim(.textmatrix(.row,5))<>"" then
                  text1.text=format(cdbl(text1.text)-cdbl(.textmatrix(.row,5),"standard")
              end if      end if 
        end with 
    end sub 
      

  13.   

    text1.text=format(cdbl(text1.text)+cdbl(.textmatrix(.row,5),"standard")text1.text=format(cdbl(text1.text)-cdbl(.textmatrix(.row,5),"standard")这两句变红掉,提示编译错误  缺少:)
      

  14.   

    '不好意思,少了一个括号
    text1.text=format(cdbl(text1.text)+cdbl(.textmatrix(.row,5)),"standard") text1.text=format(cdbl(text1.text)-cdbl(.textmatrix(.row,5)),"standard") 
      

  15.   

    Private Sub fg_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        With fg
            '假设第0列为选择标志列
          If Trim(.TextMatrix(.Row, 0)) = "" Then
              .TextMatrix(.Row, 0) = "√"
              '选中后将第5列的内容累加到text控件中
              If Trim(.TextMatrix(.Row, 1)) <> "" Then
                  Text1.Text = Format(CDbl(Text1.Text) + CDbl(.TextMatrix(.Row, 1)), "standard")
              End If
          Else
              .TextMatrix(.Row, 0) = ""
              '取消选中后将第5列的内容从text1中扣减
              If Trim(.TextMatrix(.Row, 1)) <> "" Then
                  Text1.Text = Format(CDbl(Text1.Text) - CDbl(.TextMatrix(.Row, 1)), "standard")
              End If      End If
        End With
    End Sub
    我这边改好后是这样子,运行后,一选中就会提示实施错误‘13’  类型不匹配。
    还有我为什么会是第一次单击是为不选中,第二次单击才选中。
      

  16.   

    在form_load事件中加一句:
    text1.text="0"
      

  17.   

    private sub command1_click() 
        dim i as long 
        with mshflexgrid1 
            for i=1 to .rows-1 
                if trim(.textmatrix(i,0))="√" then 
                    'conn.execute "delete * from A where id=" & fg.TextMatrix(fg.Row, 10) &"
                       conn.execute "delete * from A where id=" & fg.TextMatrix(i, 10) &"
                  end if 
            next i 
        end with 
    end sub if trim(.textmatrix(i,0))="√" then  我把这里的勾号去掉可以实现删除
    但就是不会显示这个勾出来
      

  18.   

    Private Sub mshflexgrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        with mshflexgrid1
             '假设第0列为选择标志列
           if trim(.textmatrix(.row,0))="" then
               .textmatrix(.row,0)="√"
           else
               .textmatrix(.row,0)=""
           end if
        end with
    end sub   我这边是这样,单击为不选择,也就是原本0列内容会变空掉,再单击的话就为选择有个√号。
            .textmatrix(.row,0)=""
           else
               .textmatrix(.row,0)="√"
           end if
    试过改成这样,发现这样子后不管怎么单击都是为勾状态,不会回到不选中状态。Private Sub mshflexgrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        with mshflexgrid1
             '假设第0列为选择标志列
           if trim(.textmatrix(.row,0))="" then
               .textmatrix(.row,0)="X"  '这里被我改为X
           else
               .textmatrix(.row,0)=""
           end if
        end with
    end sub
    private sub command1_click() 
        dim i as long 
        with mshflexgrid1 
            for i=1 to .rows-1 
                if trim(.textmatrix(i,0))="" then    '这里√号让我取消掉。
                    'conn.execute "delete * from A where id=" & fg.TextMatrix(fg.Row, 10) &" 
                      conn.execute "delete * from A where id=" & fg.TextMatrix(i, 10) &" 
                  end if 
            next i 
        end with 
    end sub 
    现在改成这个样子,可以单击为选择状态然后不会显示符号。
    在单击为不选择会显示X号。
       我想让选中的时候显示√怎么实现?
      

  19.   

    向mshflexgrid1控件赋值时第0列先要默认为空内容,当点击时再去改变值