I having problem get the of a form
here is the code to create the form and load my custom control (from a
button click)
Dim MatForm As New Form
Dim NewMatList As New MatListSelection
MatForm.Size = New Size(395, 218 + btnExit.Height)
MatForm.StartPosition = FormStartPosition.CenterParent
MatForm.ShowInTaskbar = False
MatForm.FormBorderStyle = FormBorderStyle.None
NewMatList.Dock = DockStyle.Top
MatForm.Controls.Add(NewMatList)
MatForm.TopMost = True
MatForm.Show()
The control fucntion fine
only when i come to dispose of the control, i want to dispose of the
form too
i have try
console.writeline(me.controls.parent.name.tostring)
console.writeline(me.controls.owner....
I get either the name of my control or blank
and many other ways i can think of
I am more than likely missing something
thank in advance
cheers
Armin Zingler - 05 Mar 2008 13:07 GMT
> I having problem get the of a form
>
[quoted text clipped - 19 lines]
> only when i come to dispose of the control, i want to dispose of the
> form too
I wouldn't do this! Controls, including Forms, will do a cascading
dispose of the contained controls.
> i have try
>
> console.writeline(me.controls.parent.name.tostring)
> console.writeline(me.controls.owner....
I don't understand this code. What is "Me"? Is this code inside your
control class or inside the Form?
> I get either the name of my control or blank
>
> and many other ways i can think of
>
> I am more than likely missing something
I cannot even compile it because the Controls collection does not have a
parent or owner property.
Armin
Herfried K. Wagner [MVP] - 05 Mar 2008 20:59 GMT
"Barkingmadscot" <barry@bcc-it.co.uk> schrieb:
> only when i come to dispose of the control, i want to dispose of the
> form too
[quoted text clipped - 5 lines]
>
> I get either the name of my control or blank
\\\
Dim ParentForm = Me.FindForm()
...
///

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>