Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
i have added some combobox rows controls to flowlayout panel ,
now i want to remove selected row of combobox .

add code is
this.Panel1.Controls.Add(combo1);
Posted

There are well-known problems with UserControls removed from a FlowLayoutPanel not being actually disposed of, resulting in, finally, out-of-memory errors.

The recommended strategy for removing and disposing UserControls from the FlowLayoutPanel is:
C#
int yourIndex;

// get the Index value and assign it to 'yourIndex

Control toRemove = yourTableLayoutPanel.Controls[yourIndex];

yourTableLayoutPanel.Controls.Remove[i];

toRemove.Dipose();
If you are creating an destroying lots of Controls in the FlowLayoutPanel, I'd suggest that for convenience you keep a Dictionary<
 
Share this answer
 
you can try this
idofcontrol.clear();
 
Share this answer
 
Ideas? What "ideas" could be needed here? Call Control.Controls.Remove.
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection.remove(v=vs.110).aspx[^].

And please understand: this forum is for software developers asking qualified questions, not for helping reading documentation for people who cannot or don't want to read it.

—SA
 
Share this answer
 
v2
Comments
BillWoodruff 1-Mar-15 21:21pm    
"And please understand: this forum is for software developers asking qualified questions, not for helping reading documentation for people who cannot or don't want to read it." Seems rather harsh to me given the context here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900