Hello,
I am creating a form dynamically based on some button click from the original form.
Now when I hit exit I want close the current form (dynamically created one), but not the orignial form:
This code is closing both the forms
Dim NewCase As New Form
Dim btnExitCase As Button = New Button
NewCase.Controls.Add(btnExitCase)
With btnExitCase
.Text = "Exit"
.Location = New Point(725, 100)
.Size = New Size(75, 25)
End With
AddHandler btnExitCase.Click, AddressOf btnExitCase_Click
Private Sub btnExitCase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
The Me.close is the one posing problem, but how else can i say close the NewCase form only.
Any help or suggestions would be appreciated.
Thanks
I am creating a form dynamically based on some button click from the original form.
Now when I hit exit I want close the current form (dynamically created one), but not the orignial form:
This code is closing both the forms
Dim NewCase As New Form
Dim btnExitCase As Button = New Button
NewCase.Controls.Add(btnExitCase)
With btnExitCase
.Text = "Exit"
.Location = New Point(725, 100)
.Size = New Size(75, 25)
End With
AddHandler btnExitCase.Click, AddressOf btnExitCase_Click
Private Sub btnExitCase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
The Me.close is the one posing problem, but how else can i say close the NewCase form only.
Any help or suggestions would be appreciated.
Thanks