2017-12-02 72 views
1
Public Sub playbtnclick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles playbutton.Click 
    Dim form2clone As New Form2 
    form2clone.Tag = selectedpicid 
    form2clone.Show() 
End Sub 


Public Sub labelclick(ByVal sender As System.Object, ByVal e As System.EventArgs) 
    Dim lbl As Label = sender 

    For Each frm2 As Form2 In 'How can I find specified form2? 
     If frm2.Tag = searchtag Then 
      TextBox1.Text = frm2.justvariable & lbl.Tag 
      Exit For 
     End If 
    Next 
End Sub 

如何在VB.net中找到指定的form2並獲取表單克隆變量?如何獲得表單克隆變量?

回答

1

您可以將您的form2添加到列表中,然後遍歷該列表。 例如

Dim ALForm2 as new list (of Form2) 
Dim form2clone As New Form2 
form2clone.Tag = selectedpicid 
form2clone.Show() 
ALForm2.Add (form2clone) 

然後可以遍歷ALForm2