如何以其他形式显示公共变量

时间:2017-01-04 10:11:55

标签: vb.net

我已经多次搜索过这个但是没有一个能为我工作所以请求帮助。我一直试图使用的代码是:

'Making the variables public in form2
Public Module GlobalVariables
    'Making the variables public 
    Public Property Juvenplp As Integer
    Public Property Adultplp As Integer
    Public Property Senileplp As Integer
    Public Property Juvensr As Single
    Public Property Adultsr As Single
    Public Property Senilesr As Single
    Public Property Birthrate As Single
    Public Property genmore As Integer
    Public Property i As Integer
End Module

然后在Form4中显示

Public Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
    InitializeComponent()
    GlobalVariables.Juvenplp = Me.Label7.Text
    GlobalVariables.Adultplp = Me.Label8.Text
    GlobalVariables.Senileplp = Me.Label9.Text
    GlobalVariables.Juvensr = Me.Label10.Text
    GlobalVariables.Adultsr = Me.Label11.Text
    GlobalVariables.Senilesr = Me.Label12.Text
    GlobalVariables.Birthrate = Me.Label14.Text
End Sub

问题在于它们没有显示出来。

0 个答案:

没有答案