Click here to Skip to main content
16,013,440 members
Home / Discussions / C#
   

C#

 
GeneralRe: Read and write to a file! Pin
leppie14-Oct-04 8:49
leppie14-Oct-04 8:49 
GeneralRe: Read and write to a file! Pin
Heath Stewart14-Oct-04 8:58
protectorHeath Stewart14-Oct-04 8:58 
GeneralRe: Read and write to a file! Pin
ee9903515-Oct-04 1:59
ee9903515-Oct-04 1:59 
GeneralInvoking Secure Web Services Pin
David Salter14-Oct-04 3:53
David Salter14-Oct-04 3:53 
GeneralRe: Invoking Secure Web Services Pin
Heath Stewart14-Oct-04 10:13
protectorHeath Stewart14-Oct-04 10:13 
Generalpropertygrid Pin
AlanJones14-Oct-04 3:43
AlanJones14-Oct-04 3:43 
GeneralSystem.OutOfMemory exception: error creating window handle Pin
Serge Lobko-Lobanovsky14-Oct-04 3:33
Serge Lobko-Lobanovsky14-Oct-04 3:33 
GeneralRe: System.OutOfMemory exception: error creating window handle Pin
Heath Stewart14-Oct-04 9:55
protectorHeath Stewart14-Oct-04 9:55 
I see from your stacktrace that you're using ShowDialog. When using modal dialogs, you need to make sure you dispose your forms or you will lose memory quickly. This isn't always a problem running under a debugger because the GC hasmore time to clean-up resources.

When displaying modal dialogs using ShowDialog, it's best to use the using block statement as below:
using (MyForm form = new MyForm())
{
  form.ShowDialog();
}
This compiles to something similar to this:
MyForm form = null;
try
{
  form = new MyForm();
  form.ShowDialog();
}
finally
{
  if (form != null) ((IDisposable)form).Dispose();
}
This way - even if an exception is thrown - the form's resources (i.e., the message pump on the new thread and other native resources used by the controls, since the controls merely encapsulate native Common Controls and other windows, are freed-up.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: System.OutOfMemory exception: error creating window handle Pin
Serge Lobko-Lobanovsky14-Oct-04 21:56
Serge Lobko-Lobanovsky14-Oct-04 21:56 
GeneralRe: System.OutOfMemory exception: error creating window handle Pin
Serge Lobko-Lobanovsky26-Oct-04 6:14
Serge Lobko-Lobanovsky26-Oct-04 6:14 
GeneralRe: System.OutOfMemory exception: error creating window handle Pin
ave\kevinchen3-May-09 23:27
ave\kevinchen3-May-09 23:27 
GeneralFilling a closed contour in a given bitmap Pin
E6AD14-Oct-04 2:52
E6AD14-Oct-04 2:52 
GeneralRe: Filling a closed contour in a given bitmap Pin
Gary Thom14-Oct-04 3:16
Gary Thom14-Oct-04 3:16 
GeneralAutomatic printing to pdf Pin
sverre.andersen14-Oct-04 0:54
sverre.andersen14-Oct-04 0:54 
GeneralRe: Automatic printing to pdf Pin
Gary Thom14-Oct-04 3:17
Gary Thom14-Oct-04 3:17 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 7:11
protectorHeath Stewart14-Oct-04 7:11 
GeneralRe: Automatic printing to pdf Pin
Gary Thom14-Oct-04 7:40
Gary Thom14-Oct-04 7:40 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 12:18
protectorHeath Stewart14-Oct-04 12:18 
GeneralRe: Automatic printing to pdf Pin
Gary Thom15-Oct-04 8:21
Gary Thom15-Oct-04 8:21 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart15-Oct-04 9:03
protectorHeath Stewart15-Oct-04 9:03 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart14-Oct-04 7:00
protectorHeath Stewart14-Oct-04 7:00 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen19-Oct-04 3:01
sverre.andersen19-Oct-04 3:01 
GeneralRe: Automatic printing to pdf Pin
Heath Stewart19-Oct-04 5:22
protectorHeath Stewart19-Oct-04 5:22 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen19-Oct-04 10:28
sverre.andersen19-Oct-04 10:28 
GeneralRe: Automatic printing to pdf Pin
sverre.andersen21-Oct-04 0:57
sverre.andersen21-Oct-04 0:57 

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.