可以用定时器Timer控件啊,设置循环时间间隔,比如300毫秒,
创新互联专注骨干网络服务器租用10年,服务更有保障!服务器租用,联通机房服务器托管 成都服务器租用,成都服务器托管,骨干网络带宽,享受低延迟,高速访问。灵活、实现低成本的共享或公网数据中心高速带宽的专属高性能服务器。
定义N个字符串变量存储要输出的第N行内容,然后,当开始执行定时器时候,每次用不同的顺序合并这N个变量,并显示。
可以的,需要判断控件类型并做一下类型转换。
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
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