一个frame里 有很多个checkbox 想实现全选的功能 如何实现 
for each checkbox in frame
    ...
next 
没用

解决方案 »

  1.   

    提示: object doesnt provider support this property or method
    checkbox我用的是控件数组
      

  2.   

    'In关键字后面必须要跟集合对象,错误在Frame前使用In
    Private Sub Command1_Click()
        Dim i As Integer, obj As Control
        For Each obj In Me.Controls
            If TypeName(obj) = "CheckBox" And obj.Container.hWnd = Frame1.hWnd Then
                obj.Value = 1
            End If
        Next
    End Sub
      

  3.   

    还是不行啊
        Dim index As Integer
        Dim obj As Control
        index = TabStrip1.SelectedItem.index - 1
         
        For Each obj In Me.Controls
            If TypeName(obj) = "CheckBox" And obj.Container.hWnd = Frame1(index).hWnd Then
                obj.Value = 1
            End If
        Next'Frame1(index).hWnd   这里有问题
      

  4.   

    报什么错?Frame1在你这里是个控件数组吗?!
      

  5.   

    是的 frame1是个也是个控件数组
      

  6.   

    'Frame1(index).hWnd   这里有问题
    ————————————————————————————————————
    具体报什么错?你TabStrip的标签页索引与Frame1控件数组的Index是如何对应的,是不是
    index = TabStrip1.SelectedItem.index - 1处不该减1,而为index = TabStrip1.SelectedItem.index?
      

  7.   

    是对应的 提示就是object doesnt provider support this property or method
      

  8.   

    obj.Container.hWnd 
    是这个 有问题  好象obj 没有 container属性
    obj 加个. 没有属性下拉框