Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a form with textboxes that will only hold text without @Old at the end of the file. If a file does have @Old at the end it goes to the Rich Text Box of the PrintView form easy printing.

 

if(Old)

{

PrintViewForm P=new PrintViewForm();

P.GetItFromFile(file);

P.Show();

}

 

The problem is that it is in a loop and need to be in a loop to work correctly. So, I need one to initially be created and all others to append to the text in that same one.

 

The loop circles again and again so I cannot just put the initialization outside the loop I need to learn how to reference a form and how to check if one is already open or not.

C#
Posted (edited)

It would not compile like this:

 

if(Old)

{

PrintViewForm P;

if(P==null)

{

P=new PrintViewForm();

P.GetItFromFile(FileArr[k]);

P.Show();

}

else P.GetItFromFile(FileArr[k]);

 

Says, use of unassigned local variable P and when I assigned P to null it compiles but a whole bunch of forms pop up like before.

 

I have an idea, maybe I can do a search for the PrintViewForm type. But how?

Edited by aewarnick
C#

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...