How to pass value from Form1 to Form2

后端 未结 2 735
渐次进展
渐次进展 2020-12-20 10:52

I\'m making a program that generates SQL Server code to use it in my VB.NET program.

I have this first form that contains the connection like you see in picture belo

2条回答
  •  余生分开走
    2020-12-20 11:24

    This question is a bit confusing, but this is how I would pass a variable from one form to another.

    Create a class /w variable.

    Public Class Variables
    
        Public Shared Property imavariable As String
            Get
                Return m_imavariable 
            End Get
            Set(value As String)
                m_imavariable = value
            End Set
        End Property
        Private Shared m_imavariable As String
    
    End Class
    

    Set the variable from form 1... variables.imavariable = string Read the variable from form2.... string = variables.imavariable

提交回复
热议问题