Hey guys,
I've got a little project that requires me to dynamically create a new instance of an existing form (along with all the controls inside that form) when a specific button is clicked. That part's easy enough...
Several new instances of the existing form will be created at run-time, so I need a way to access each new form (and all of its child controls) individually in order to manipulate the controls in each form separately. So right after I dynamically create the new form, I assign that form's "tag" value the same as the value of a texbox...
So later on in another subroutine, I need a way to access whichever dynamically created form has the "tag" value that is equal to the value of TextBox1.Text. For example (the following code doesn't work, obviously, but you should be able to figure out what I'm trying to do)...
How can I accomplish this? Or is there a better way to go about this?
BTW, am using WinForms and targeting the .NET 2.0 framework.
I've got a little project that requires me to dynamically create a new instance of an existing form (along with all the controls inside that form) when a specific button is clicked. That part's easy enough...
Code:
Dim NewForm As New ExistingFormCode:
NewForm.Tag = TextBox1.TextCode:
For Each DynamicallyCreatedForm As Form In (All Forms)
If DynamicallyCreatedForm.Tag = TextBox1.Text Then
' Do stuff for the desired form here
EndIf
NextBTW, am using WinForms and targeting the .NET 2.0 framework.