We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Saving and Loading TabbedMDI State to a string

I am using the following code to save and load tabbedMDIState to a string. Saving is working but Load does not work. I am not sure if I am
missing something here. Help in this regard would be appreciated.

Save :
-----------------------------------------------
MemoryStream xmlStream = new MemoryStream();
AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFmtStream, xmlStream);

this.tabbedMdiManager.SaveTabGroupStates(aser);
aser.PersistNow();

xmlStream.Position = 0;
System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(xmlStream);
string s=null;
while (reader.Read())
{
s = reader.ReadString();
if(s.Contains(" }
tabState.Remove(0, tabState.Length);
tabState.Append(s);
while (reader.Read())
{
tabState.Append(reader.ReadString());
}
xmlStream.Close();
reader.Close();
-------------------------------------------------
Load.
-------------------------------------------------
MemoryStream xmlStream = new MemoryStream();
UTF8Encoding x = new UTF8Encoding();
byte[] y = x.GetBytes(tabState.ToString());
xmlStream.Write(y, 0, y.Length);
xmlStream.Position = 0;
Console.WriteLine(tabState.ToString());

AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFmtStream,xmlStream);
this.tabbedMdiManager.LoadTabGroupStates(aser);

xmlStream.Close();

3 Replies

PJ Poly J Syncfusion Team February 15, 2007 07:28 PM UTC

Hi Surya,

Are you loading the tab state info for the child forms creating in run time? If you are doing so, you should create the forms before loading the tab state.
Please refer the sample attached in the previous thread (http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=56114).
If I have misunderstood your requirement please let me know.

Regards,
Poly



SU Surya February 15, 2007 07:58 PM UTC

Poly :

Thanks for your very good example.

But here ..
I am just trying to save the state to a string
and reload it on click of a button.I am not exiting the application

Thanks
Surya


PJ Poly J Syncfusion Team February 16, 2007 07:27 AM UTC

Hi Surya,

Thanks for the update.

You can use the same approach shown in the last sample for reload the tab state in button click event. You can save the child forms name in Array list when saving the state and when button click for loading the previously saved state, recreate the child forms which are not present in the Mdi children collection and load the tab states.

Please let me know if you need further assistance with this incident.

Thanks for your interest in Syncfusion products.

Regards,
Poly

Loader.
Live Chat Icon For mobile
Up arrow icon