Windows Develop Bookmark and Share   
 index > Windows Forms General > Deleting non focused controls at runtime .
 

Deleting non focused controls at runtime .

How to delete the controls label ,picturebox at runtime ,when Delete key is pressed .

Presently it is not firing the event .

_KeyDown event .. not firing for picturebox,label controls

panel.remove(sender)

SilverPlate  Saturday, February 09, 2008 2:56 PM

Hi, if you want to remove control atruntime, you can try following code

Code Snippet

if (e.KeyCode == Keys.Delete)

{

this.Controls.RemoveByKey("ControlName");

}

For more information,please check following thread which talked this topic before.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=787687&SiteID=1

Best Regards

Gavin

Gavin Jin - MSFT  Wednesday, February 13, 2008 3:46 AM

Hi, if you want to remove control atruntime, you can try following code

Code Snippet

if (e.KeyCode == Keys.Delete)

{

this.Controls.RemoveByKey("ControlName");

}

For more information,please check following thread which talked this topic before.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=787687&SiteID=1

Best Regards

Gavin

Gavin Jin - MSFT  Wednesday, February 13, 2008 3:46 AM

You can use google to search for other answers

Custom Search

More Threads

• security permissions for System.io.ports class.
• removing rows from TableLayoutPanel
• c# .net word-xp textbox
• Determining a keystroke combinaiton
• How to change other application tray's tips and icon?(C#)
• Controls.Clear and SuspendLayout
• How use MouseUp evnet in ScrollBar
• Mater Details records in DataGridView
• Help with TextBox Validation using a function
• urgent problem : XY Plot Disappears (dont know how to implement onpaint)