Click here to Skip to main content
15,887,242 members
Home / Discussions / C#
   

C#

 
GeneralRe: Socket and Thread Question Pin
jason_mf8-Nov-10 18:58
jason_mf8-Nov-10 18:58 
QuestionMultiThreading Pin
RoboAlex8-Nov-10 17:26
RoboAlex8-Nov-10 17:26 
AnswerRe: MultiThreading Pin
Luc Pattyn8-Nov-10 17:31
sitebuilderLuc Pattyn8-Nov-10 17:31 
GeneralRe: MultiThreading Pin
Rajesh Anuhya8-Nov-10 18:57
professionalRajesh Anuhya8-Nov-10 18:57 
AnswerRe: MultiThreading Pin
David Skelly8-Nov-10 22:27
David Skelly8-Nov-10 22:27 
AnswerRe: MultiThreading Pin
Luc Pattyn9-Nov-10 1:37
sitebuilderLuc Pattyn9-Nov-10 1:37 
QuestionReturn all form controls to default state Pin
kruegs358-Nov-10 17:20
kruegs358-Nov-10 17:20 
AnswerRe: Return all form controls to default state Pin
Luc Pattyn8-Nov-10 17:26
sitebuilderLuc Pattyn8-Nov-10 17:26 
Two easy ways would be:

1. create a new Form
2. remove all top-level controls (this.Controls.Clear) and call InitComponent() again.

Both are more costly than is necessary.

Approach #3: You could enumerate all controls and reset them; in general this takes a recursive approach as TextBoxes could sit in Panels in SplitContainers, etc.

All these approaches have one thing in common: they are Form-agnostic, they don't really care exactly what Controls are present.

Approach #4 (More advanced): if your app is data-driven, chances are your Form represents one data object which has a class and probably also a DataRow, corresponding to a row in some DB table. If so, you are already using data binding, and could bind with a new (i.e. empty) object to clear everything.

FWIW a final remark: if your Form holds that many Controls that you see clearing them as a problem, then your users will probably not like it either for how it looks and how uneasy it is to use.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


QuestionCan you gain administrator permission in .NET program? Pin
John Kenedy S.Kom8-Nov-10 16:08
John Kenedy S.Kom8-Nov-10 16:08 
AnswerRe: Can you gain administrator permission in .NET program? Pin
Jacob D Dixon8-Nov-10 17:44
Jacob D Dixon8-Nov-10 17:44 
AnswerRe: Can you gain administrator permission in .NET program? Pin
David Ewen8-Nov-10 17:55
professionalDavid Ewen8-Nov-10 17:55 
GeneralRe: Can you gain administrator permission in .NET program? Pin
John Kenedy S.Kom9-Nov-10 0:41
John Kenedy S.Kom9-Nov-10 0:41 
GeneralRe: Can you gain administrator permission in .NET program? Pin
Dave Kreskowiak9-Nov-10 2:05
mveDave Kreskowiak9-Nov-10 2:05 
GeneralRe: Can you gain administrator permission in .NET program? Pin
John Kenedy S.Kom9-Nov-10 14:32
John Kenedy S.Kom9-Nov-10 14:32 
GeneralRe: Can you gain administrator permission in .NET program? Pin
Dave Kreskowiak9-Nov-10 18:37
mveDave Kreskowiak9-Nov-10 18:37 
GeneralRe: Can you gain administrator permission in .NET program? Pin
David Ewen9-Nov-10 12:00
professionalDavid Ewen9-Nov-10 12:00 
QuestionAbout AutoResetEvent, a simple question Pin
jason_mf8-Nov-10 1:15
jason_mf8-Nov-10 1:15 
AnswerRe: About AutoResetEvent, a simple question Pin
Luc Pattyn8-Nov-10 1:42
sitebuilderLuc Pattyn8-Nov-10 1:42 
GeneralRe: About AutoResetEvent, a simple question Pin
RaviRanjanKr8-Nov-10 1:58
professionalRaviRanjanKr8-Nov-10 1:58 
GeneralRe: About AutoResetEvent, a simple question Pin
John Kenedy S.Kom8-Nov-10 16:11
John Kenedy S.Kom8-Nov-10 16:11 
QuestionDataGridView Pin
yesu prakash8-Nov-10 0:31
yesu prakash8-Nov-10 0:31 
AnswerRe: DataGridView Pin
Mycroft Holmes8-Nov-10 11:14
professionalMycroft Holmes8-Nov-10 11:14 
Questionretrieving listview values Pin
annie_bel8-Nov-10 0:13
annie_bel8-Nov-10 0:13 
AnswerRe: retrieving listview values Pin
phil.o8-Nov-10 0:19
professionalphil.o8-Nov-10 0:19 
GeneralRe: retrieving listview values Pin
annie_bel8-Nov-10 0:40
annie_bel8-Nov-10 0:40 

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.