Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello friends.... i have created a application like notepad++ and i am facing difficulties to save the document.. i am not able to save each and every document which is created or opened in tabs at closing event of form...
pls get me help asap..

thanks..
Posted
Comments
[no name] 6-Jul-12 14:47pm    
"pls get me help"... Help like a dictionary (no such word as pls)? Do you have a preference where we should get you help from? What errors are you getting? Where is the code that demonstrates your problem? "i am not able to save"... is not a helpful description of any sort of problem. Why are you not able? The hard drive won't let you?
ZurdoDev 6-Jul-12 15:07pm    
Why can't you save each document in the tabs?

1 solution

Assuming you have them as a document inside separate TabPage objects within a TabControl, all you have to do is loop through the pages and call your Save method on each of them:

C#
foreach (TabPage page in MyTabs.TabPages)
   {
   foreach (Control c in page.Controls)
      {
      MyDocument md = page.Controls[0] as MyDocument;
      if (md != null)
         {
         md.Save();
         break;
         }
      }      
   }
The outer loop examines each TabPage, the inner loop finds the document within the Page and saves it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900