Click here to Skip to main content
15,890,043 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing Objects From Child Form Back To User Control Pin
OriginalGriff8-Oct-10 1:47
mveOriginalGriff8-Oct-10 1:47 
AnswerRe: Passing Objects From Child Form Back To User Control Pin
#realJSOP8-Oct-10 2:32
mve#realJSOP8-Oct-10 2:32 
QuestionToolbar editing example code please. Pin
Jung Sung Uk7-Oct-10 21:00
Jung Sung Uk7-Oct-10 21:00 
QuestionUnit Test a database update code? Pin
Shubhabrata Mohanty7-Oct-10 20:42
Shubhabrata Mohanty7-Oct-10 20:42 
AnswerRe: Unit Test a database update code? Pin
Abhinav S7-Oct-10 22:39
Abhinav S7-Oct-10 22:39 
AnswerRe: Unit Test a database update code? Pin
LLambert8-Oct-10 0:43
LLambert8-Oct-10 0:43 
AnswerRe: Unit Test a database update code? Pin
Richard A. Dalton8-Oct-10 6:00
Richard A. Dalton8-Oct-10 6:00 
QuestionFlowLayourPanel only removes visible control? [modified] Pin
Charles Cox7-Oct-10 16:06
Charles Cox7-Oct-10 16:06 
Ok, I've been working on a user control that basically houses a FlowLayoutPanel control and allows you to add PictureBox Controls through code. The adding part works, however the code that removes the PictureBox's only seems to remove the ones that are visible.

This is the code that removes the controls:

public void RemovePictures()
{
    foreach (Control pic in flpPanel.Controls)
    {
         pic.Click -= PictureClicked;
         flpPanel.Controls.Remove(pic);
         pic.Dispose();
    }
}


flpPanel is a FlowLayoutPanel as I stated above.

Am I doing something wrong, is this a bug? I am using Visual C# Express 2010 and building in .Net Framework 4.0

Update:

A look at the Methods supported by the ControlsCollection class i see a Clear() method. (I should have guessed considering its a collection) Anyway, I'm worried about using this rather than what was above as Clear() does not give me the ability to unhook the event from each picture box...

Anyone have an idea of whether this is a bad thing?

modified on Thursday, October 7, 2010 10:34 PM

AnswerRe: FlowLayourPanel only removes visible control? Pin
Luc Pattyn7-Oct-10 16:30
sitebuilderLuc Pattyn7-Oct-10 16:30 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Charles Cox7-Oct-10 16:46
Charles Cox7-Oct-10 16:46 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Luc Pattyn7-Oct-10 16:53
sitebuilderLuc Pattyn7-Oct-10 16:53 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Charles Cox7-Oct-10 17:03
Charles Cox7-Oct-10 17:03 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Luc Pattyn7-Oct-10 17:16
sitebuilderLuc Pattyn7-Oct-10 17:16 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Charles Cox7-Oct-10 17:24
Charles Cox7-Oct-10 17:24 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Luc Pattyn7-Oct-10 17:29
sitebuilderLuc Pattyn7-Oct-10 17:29 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Charles Cox7-Oct-10 17:33
Charles Cox7-Oct-10 17:33 
GeneralRe: FlowLayourPanel only removes visible control? Pin
Luc Pattyn7-Oct-10 17:36
sitebuilderLuc Pattyn7-Oct-10 17:36 
QuestionHow to present an openning screen (form) in C# application? Pin
Shultz 27-Oct-10 9:23
Shultz 27-Oct-10 9:23 
AnswerRe: How to present an openning screen (form) in C# application? Pin
Ian Shlasko7-Oct-10 9:40
Ian Shlasko7-Oct-10 9:40 
GeneralRe: How to present an openning screen (form) in C# application? Pin
Luc Pattyn7-Oct-10 9:59
sitebuilderLuc Pattyn7-Oct-10 9:59 
GeneralRe: How to present an openning screen (form) in C# application? Pin
Shultz 27-Oct-10 10:55
Shultz 27-Oct-10 10:55 
GeneralRe: How to present an openning screen (form) in C# application? Pin
Luc Pattyn7-Oct-10 11:01
sitebuilderLuc Pattyn7-Oct-10 11:01 
GeneralRe: How to present an openning screen (form) in C# application? Pin
Shultz 27-Oct-10 13:07
Shultz 27-Oct-10 13:07 
GeneralRe: How to present an openning screen (form) in C# application? Pin
Luc Pattyn7-Oct-10 13:24
sitebuilderLuc Pattyn7-Oct-10 13:24 
AnswerRe: How to present an openning screen (form) in C# application? Pin
#realJSOP7-Oct-10 23:39
mve#realJSOP7-Oct-10 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.