Click here to Skip to main content
15,917,793 members
Home / Discussions / C#
   

C#

 
GeneralRe: to return or not to return something [modified] Pin
pauli17-Mar-08 23:01
pauli17-Mar-08 23:01 
GeneralRe: to return or not to return something Pin
Simon P Stevens18-Mar-08 6:07
Simon P Stevens18-Mar-08 6:07 
Generalgeneric collection - .net 2.0 Pin
arkiboys17-Mar-08 4:22
arkiboys17-Mar-08 4:22 
GeneralRe: generic collection - .net 2.0 Pin
Luc Pattyn17-Mar-08 4:29
sitebuilderLuc Pattyn17-Mar-08 4:29 
QuestionActive Directory "login" from C# application Pin
User 137680017-Mar-08 3:52
User 137680017-Mar-08 3:52 
GeneralResource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 3:45
Kolobock17-Mar-08 3:45 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Luc Pattyn17-Mar-08 3:55
sitebuilderLuc Pattyn17-Mar-08 3:55 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 4:07
Kolobock17-Mar-08 4:07 
Hi
Yes of course.
The empty OnTimer handler removes resource leak.
The using Timer from Forms namespace removes leak too.
You are absolutely right.

But problem is that I need to add string into text control from other (not main window) thread Frown | :-(
This simple project is created specially for demonstrate a standard method for
add a text string into TextBox control from other thread!
This demo is based on standard sample from MSDN and it has leak!!!

I know that the permanent resource leak is in following part of source code:

delegate void AddTextCallback(string text);
AddTextCallback d;
object[] arg = new object[1];
private void AddTerminalText(string text)
{
if (textBox1.InvokeRequired)
{
if (d == null)
{
d = new AddTextCallback(AddTerminalText);
}
arg[0] = text;
textBox1.Invoke(d, arg);
}
else
{
textBox1.AppendText(text); // add text into control ...
}
}

How I can add text correctly into text box from other thread ?

Roman
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Luc Pattyn17-Mar-08 4:25
sitebuilderLuc Pattyn17-Mar-08 4:25 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 8:32
Kolobock17-Mar-08 8:32 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Luc Pattyn17-Mar-08 8:44
sitebuilderLuc Pattyn17-Mar-08 8:44 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 10:18
Kolobock17-Mar-08 10:18 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Rob Philpott17-Mar-08 4:10
Rob Philpott17-Mar-08 4:10 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 8:34
Kolobock17-Mar-08 8:34 
GeneralRe: Resource leak (handles count) in simple .NET application Pin
Kolobock17-Mar-08 23:57
Kolobock17-Mar-08 23:57 
GeneralIP Camera with C# Pin
sher1217-Mar-08 3:44
sher1217-Mar-08 3:44 
GeneralRe: IP Camera with C# Pin
Luc Pattyn17-Mar-08 3:59
sitebuilderLuc Pattyn17-Mar-08 3:59 
GeneralScreen Shot Pin
sjs4u17-Mar-08 2:18
sjs4u17-Mar-08 2:18 
GeneralRe: Screen Shot Pin
ritz123417-Mar-08 2:45
ritz123417-Mar-08 2:45 
GeneralRe: Screen Shot Pin
sjs4u17-Mar-08 2:48
sjs4u17-Mar-08 2:48 
GeneralRe: Screen Shot Pin
Christian Graus17-Mar-08 9:18
protectorChristian Graus17-Mar-08 9:18 
GeneralRe: Screen Shot Pin
Kristian Sixhøj17-Mar-08 3:58
Kristian Sixhøj17-Mar-08 3:58 
GeneralUnable to start debugging a web application in VS2003 Pin
i_want_to_learn_c#17-Mar-08 1:54
i_want_to_learn_c#17-Mar-08 1:54 
GeneralRe: Unable to start debugging a web application in VS2003 Pin
Rob Philpott17-Mar-08 2:27
Rob Philpott17-Mar-08 2:27 
GeneralRe: Unable to start debugging a web application in VS2003 Pin
i_want_to_learn_c#17-Mar-08 2:49
i_want_to_learn_c#17-Mar-08 2:49 

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.