什么是在vb2005中完成表单上所有控件的最佳方法?我正在编写一个程序,可以根据表单上的信息编辑一串字节.每个控件都使用它修改的十六进制地址和值来标记,即使嵌入在其他控件中的控件,通过表单上所有控件的最佳方法是什么?
像这样的东西,传递形式开始:
Private Sub DoSomethingToAllControls(ByVal Container As Control)
Dim ctl As Control
For Each ctl In Container.Controls
' Do Something..
' Recursively call this function for any container controls.
If ctl.HasChildren Then
DoSomethingToAllControls(ctl)
End If
Next
End Sub
Run Code Online (Sandbox Code Playgroud)