Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: passing values from a windows form to a crystal report Pin
myinstincts14-Aug-09 2:49
myinstincts14-Aug-09 2:49 
AnswerRe: passing values from a windows form to a crystal report Pin
Anubhava Dimri17-Aug-09 0:07
Anubhava Dimri17-Aug-09 0:07 
QuestionBring to Front and Send to back Pin
Anubhava Dimri13-Aug-09 23:55
Anubhava Dimri13-Aug-09 23:55 
AnswerRe: Bring to Front and Send to back Pin
0x3c014-Aug-09 0:17
0x3c014-Aug-09 0:17 
GeneralRe: Bring to Front and Send to back Pin
Coding C#14-Aug-09 2:50
Coding C#14-Aug-09 2:50 
GeneralRe: Bring to Front and Send to back Pin
Anubhava Dimri16-Aug-09 23:48
Anubhava Dimri16-Aug-09 23:48 
QuestionMyObject = New Object memory use Pin
Johan Hakkesteegt13-Aug-09 22:22
Johan Hakkesteegt13-Aug-09 22:22 
AnswerRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 0:57
sitebuilderLuc Pattyn14-Aug-09 0:57 
Hi,

assuming VB.NET, if you do
[1]   Dim MyObject As Object
[2]   MyObject = New Object  ' object 1
[3]   MyObject = New Object  ' object 2


then object 1 will become collectible when line [3] executes, meaning the garbage collector will collect object 1 the next time it runs (normally it runs when a future memory allocation cannot be satisfied without cleaning up memory first).

And this is fine, unless it is a type that implements Dispose or Close, as in:
[1]   Dim MyObject As Font
[2]   MyObject = New Font(...) ' object 1
[4]   MyObject = New Font(...) ' object 2


now you should insert [3] MyObject.Dispose() to make sure the unmanaged resources that might be held by the object get released right away (or the file or stream or whatever gets closed).

If you don't Close/Dispose objects that support it, your app will use more memory and other system resources, and its behavior may deteriorate. Yes, the garbage collector will still find those objects, and its finalizer thread will eventually Dispose of them, but that typically will be much later.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: MyObject = New Object memory use Pin
Johan Hakkesteegt14-Aug-09 1:43
Johan Hakkesteegt14-Aug-09 1:43 
GeneralRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 1:50
sitebuilderLuc Pattyn14-Aug-09 1:50 
GeneralRe: MyObject = New Object memory use Pin
Johan Hakkesteegt14-Aug-09 2:13
Johan Hakkesteegt14-Aug-09 2:13 
GeneralRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 2:20
sitebuilderLuc Pattyn14-Aug-09 2:20 
QuestionHow can I bring Page x from a TabControl? Pin
waner michaud13-Aug-09 11:03
waner michaud13-Aug-09 11:03 
AnswerRe: How can I bring Page x from a TabControl? [modified] Pin
Henry Minute13-Aug-09 11:24
Henry Minute13-Aug-09 11:24 
GeneralRe: How can I bring Page x from a TabControl? Pin
Luc Pattyn13-Aug-09 11:40
sitebuilderLuc Pattyn13-Aug-09 11:40 
GeneralRe: How can I bring Page x from a TabControl? Pin
Henry Minute13-Aug-09 11:51
Henry Minute13-Aug-09 11:51 
AnswerRe: How can I bring Page x from a TabControl? Pin
Luc Pattyn13-Aug-09 11:41
sitebuilderLuc Pattyn13-Aug-09 11:41 
QuestionOrganize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 7:46
MatthewStLawrence13-Aug-09 7:46 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
Dave Kreskowiak13-Aug-09 8:08
mveDave Kreskowiak13-Aug-09 8:08 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 8:13
MatthewStLawrence13-Aug-09 8:13 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
0x3c013-Aug-09 8:17
0x3c013-Aug-09 8:17 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
Luc Pattyn13-Aug-09 9:01
sitebuilderLuc Pattyn13-Aug-09 9:01 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence13-Aug-09 9:16
MatthewStLawrence13-Aug-09 9:16 
GeneralRe: Organize files by modified date into folders \\year\month\file.doc Pin
Luc Pattyn13-Aug-09 9:21
sitebuilderLuc Pattyn13-Aug-09 9:21 
AnswerRe: Organize files by modified date into folders \\year\month\file.doc Pin
MatthewStLawrence17-Aug-09 9:49
MatthewStLawrence17-Aug-09 9: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.