Ezguy Posted August 6, 2003 Posted August 6, 2003 HI iam creating picturebox control with picture at runtime. this is my problem when I delete one of the them using the controlname.dispose() Iam still able to acces the control properties by refering to its name please tell me how to delete this permanently Quote www.itfriend.com [ get connected with your IT friends]
*Experts* Volte Posted August 6, 2003 *Experts* Posted August 6, 2003 ControlName.Dispose() ControlName = Nothing That should do it. Quote
Ezguy Posted August 6, 2003 Author Posted August 6, 2003 No it's working Iam still able to access it Quote www.itfriend.com [ get connected with your IT friends]
Leaders dynamic_sysop Posted August 6, 2003 Leaders Posted August 6, 2003 try this... Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Button2.Dispose() Controls.Remove(Button2) '/// you must remove it from the form's control collection. Button2 = Nothing If Not Button2 Is Nothing Then MessageBox.Show("still exsists!") Else MessageBox.Show("it's gone!") End If End Sub Quote
*Experts* mutant Posted August 6, 2003 *Experts* Posted August 6, 2003 I dont know if I understood your correctly but you will always be able to access the control from code, even if its disposed because the variable held the instance of the control is still there. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.