Passing variables between windows forms in VS 2010

前端 未结 3 478
你的背包
你的背包 2021-01-14 03:34

I have two forms. Form 1 allows the user to pick an employee from a dropdown combo box. That employee is then passed onto Form 2 where the user enters additional information

3条回答
  •  遥遥无期
    2021-01-14 04:10

    Change your code in Form2.vb for the New sub to this:

    Public Sub New(ByVal Employee As String)
    
        ' This call is required by the designer.
    
        InitializeComponent()
    
        ' Add any initialization after the InitializeComponent() call.
    
        MsgBox(Employee)
    
    End Sub
    

    If you don't call InitializeComponent(), your complete GUI is not going to render.

提交回复
热议问题