我曾经在我的一个项目中使用模块来格式化excel工作簿中所有用户形式的文本框,代码看起来像:
Sub TxtBx(i As Integer)
Dim uf As UserForm
For Each uf In UserForms
With uf("TextBox" & i)
If .Text Like "" Then
......................................
现在我将项目移动到应用程序,我需要相同的模块进行格式化。那么如何在Windows Form Application中说:
Module Module1
Sub TxtBx(i As Integer)
Dim f As System.Windows.Forms.Form
For Each f As System.Windows.Forms
With f("TextBox" & i)
.....................
答案 0 :(得分:0)
我无法用.Net制作它。我把它切换到VB6,它看起来像:
Sub TxtBx(i As Integer)
s.Language = "VBScript"
For Each uf In Forms
With uf("TextBox" & i)
If .Text Like "" Or .Text Like "-"
..................