Click here to Skip to main content
15,891,423 members
Home / Discussions / C#
   

C#

 
Questionloading the header of document file Pin
Miss_hacker8-Jul-08 10:02
Miss_hacker8-Jul-08 10:02 
AnswerRe: loading the header of document file Pin
Nitrus8-Jul-08 10:20
Nitrus8-Jul-08 10:20 
JokeRe: loading the header of document file Pin
PIEBALDconsult8-Jul-08 10:57
mvePIEBALDconsult8-Jul-08 10:57 
GeneralRe: loading the header of document file Pin
leppie8-Jul-08 20:50
leppie8-Jul-08 20:50 
JokeRe: loading the header of document file Pin
PIEBALDconsult9-Jul-08 5:04
mvePIEBALDconsult9-Jul-08 5:04 
QuestionPossible bug! iTunes event handlers do not work with Clipboard! Pin
Nitrus8-Jul-08 9:43
Nitrus8-Jul-08 9:43 
AnswerRe: Possible bug! iTunes event handlers do not work with Clipboard! Pin
leppie8-Jul-08 22:37
leppie8-Jul-08 22:37 
QuestionScope of variable Pin
zafersavas8-Jul-08 9:28
zafersavas8-Jul-08 9:28 
I know this is a simple question but I would like to know How and Why this works;

Lets say I have two forms : Form1 and Form2 where Form1 is the main form. I am creating a Form2 variable by clicking a button in Form1 as seen in the code piece below.
private void button1_Click(object sender, EventArgs e)
{
    Form2 myForm2 = new Form2();
    myForm2.Show();
}

Why am I able to see form2. Because myForm2 is a local variable and just after it is shown, the function button1_Click terminates. So I mustn't be able to see Form2.

NOTE-1 : If you try the same with MS VC++ you will not be able to see Form2.
NOTE-2 : I know in .NET variables are not deleted when they are out out of scope. Garbage collector does it. Bu in an other function I tried GC.Collect(); which forces the garbage collector but Form2 still remains, it is not deleted.

Regards
AnswerRe: Scope of variable Pin
Luc Pattyn8-Jul-08 9:31
sitebuilderLuc Pattyn8-Jul-08 9:31 
GeneralRe: Scope of variable Pin
zafersavas8-Jul-08 9:38
zafersavas8-Jul-08 9:38 
GeneralRe: Scope of variable Pin
Luc Pattyn8-Jul-08 9:43
sitebuilderLuc Pattyn8-Jul-08 9:43 
GeneralRe: Scope of variable Pin
Frank Horn8-Jul-08 10:41
Frank Horn8-Jul-08 10:41 
AnswerRe: Scope of variable Pin
PIEBALDconsult8-Jul-08 10:25
mvePIEBALDconsult8-Jul-08 10:25 
AnswerRe: Scope of variable Pin
Nirandas8-Jul-08 17:56
Nirandas8-Jul-08 17:56 
GeneralRe: Scope of variable Pin
zafersavas9-Jul-08 6:16
zafersavas9-Jul-08 6:16 
Questionwhat's mail Pin
fazel dehghani8-Jul-08 8:33
fazel dehghani8-Jul-08 8:33 
AnswerRe: what's mail Pin
DaveyM698-Jul-08 8:48
professionalDaveyM698-Jul-08 8:48 
AnswerRe: what's mail Pin
Christian Graus8-Jul-08 14:28
protectorChristian Graus8-Jul-08 14:28 
AnswerRe: what's mail Pin
Paul Conrad8-Jul-08 15:45
professionalPaul Conrad8-Jul-08 15:45 
Questionhow to asterisk in datagrid Pin
netJP12L8-Jul-08 7:35
netJP12L8-Jul-08 7:35 
AnswerRe: how to asterisk in datagrid Pin
led mike8-Jul-08 8:53
led mike8-Jul-08 8:53 
AnswerRe: how to asterisk in datagrid Pin
PIEBALDconsult8-Jul-08 9:16
mvePIEBALDconsult8-Jul-08 9:16 
QuestionAdding a DBNull value as a parameter to a Int32 database field. Pin
Steve Holdorf8-Jul-08 7:01
Steve Holdorf8-Jul-08 7:01 
AnswerRe: Adding a DBNull value as a parameter to a Int32 database field. Pin
PIEBALDconsult8-Jul-08 7:18
mvePIEBALDconsult8-Jul-08 7:18 
AnswerRe: Adding a DBNull value as a parameter to a Int32 database field. Pin
Steve Holdorf8-Jul-08 7:21
Steve Holdorf8-Jul-08 7:21 

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.