符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
Public Sub GetAllControls(ByVal InContainer As Control, ByRef RecieveList As ListBox)
创新互联一直通过网站建设和网站营销帮助企业获得更多客户资源。 以"深度挖掘,量身打造,注重实效"的一站式服务,以做网站、成都做网站、移动互联产品、营销型网站服务为核心业务。十余年网站制作的经验,使用新网站建设技术,全新开发出的标准网站,不但价格便宜而且实用、灵活,特别适合中小公司网站制作。网站管理系统简单易用,维护方便,您可以完全操作网站资料,是中小公司快速网站建设的选择。
For i As Integer = 0 To InContainer.Controls.Count - 1
If InContainer.Controls.Item(i).Text "" Then
GetList.Items.Add(InContainer.Controls.Item(i).Text vbCrLf)
End If
If InContainer.Controls.Item(i).Controls.Count 0 Then
GetAllControls(InContainer.Controls.Item(i), GetList)
End If
Next
End Sub
这段代码可行,但不能遍历菜单和工具栏,要按需要修改
c# 用程序转的,也不知道对不对。你看看有没有帮助 ,这是遍历所有控件,还有一个办法就是重载form的消息处理函数应该也是可以的。
STAThread _
Public Shared Sub Main(args As String())
Dim button = New Button()
button.Text = "我是按钮"
button.Dock = DockStyle.Fill
Dim form = New Form()
form.Controls.Add(button)
CapturehMouseClickEvent(form)
form.ShowDialog()
End Sub
Private Shared Sub CapturehMouseClickEvent(control As Control)
AddHandler control.Click, AddressOf ControlOnClick
For Each subControl As Control In control.Controls
CapturehMouseClickEvent(subControl)
Next
End Sub
Private Shared Sub ControlOnClick(sender As Object, eventArgs As EventArgs)
Debug.WriteLine("控制被单击")
End Sub
Public Sub ReSetText(Control ctrl)
Dim ct As Control
For Each ct In ctrl.Controls
Try
For Each ct2 As Control In ct.Controls
ReSetText(ct2)
Next
Catch
End Try
If (TypeOf ct Is TextBox) Then
ct.Text = ""
ElseIf (TypeOf ct Is ComboBox) Then
Dim cb As System.Windows.Forms.ComboBox = DirectCast(ct, System.Windows.Forms.ComboBox)
cb.SelectedIndex = -1
End If
Next
End Sub
因为textbox在窗体里的panel里,你只遍历窗体的控件是不够的。
For Each ctl As Control In Me.Controls If TryCast(ctl, TextBox) Nothing Then Dim txt As TextBox = TryCast(ctl, TextBox) txt.Text = "" End If
下面示例代码供题主参考。单击命令按钮将该窗体内的所有控件名显示到列表框里
Private Sub Command1_Click()
Dim ctl As Control
List1.Clear
For Each ctl In Form1
List1.AddItem ctl.Name
Next ctl
End Sub
可以的,需要判断控件类型并做一下类型转换。
For Each c As Control In Me.Controls
If TypeOf(c) Is TextBox Then
Dim t As TextBox = CType(c ,TextBox)
'调用t的方法即可
End If
Next