vb 2012模块(F作为表格)

时间:2014-06-14 05:31:34

标签: vb.net

我的模块代码是

Module print
 Sub Pad (F as form)
  F.Textbox1.text = "testing"
 End sub
End module

有没有办法将“print.pad”用于我的3形式(FrmNew,FrmOld,FrmAdmin),就像这样

Public Class FrmNew

 Private Sub FrmNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  Print.Pad(Me)
 End Sub

End Class

因为在VBA中它起作用。

VBA MODULE代码(模块名称Printt)

Sub Pad(f As Form)
 f.Text0 = "testing"
End Sub

VBA表格代码(表格名称Form1)

Private Sub Form_Load()
 Call Printt.Pad(Form_Form1)
End Sub

或任何方式去做。 tnx提前...

1 个答案:

答案 0 :(得分:0)

Module print
  Public Sub Pad (ByVal txtControl As TextBox)
  txtControl.Text = "testing"
 End sub
End module

并调用

 Public Class FrmNew
        Private Sub FrmNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          Print.Pad(textbox1)
        End Sub
End Class
  • 此处textbox1是您FrmNew中的控件,在此您想要展示textbox1.text = "testing"