I'm new to Dock Panel suite
Basically i'm having run time error when it comes to loading layout from xml file. saving layout works fine.
I have 2 forms, 1st one is main form. 2nd form is child form
public ref class MyForm2 : DockContent
in main form, i have following code
private: IDockContent ^GetContentFromPersistString(System::String ^persistString)
{
array<Char>^ id = { ',' };
array<System::String^> ^parsedStrings = persistString->Split(id);
if (parsedStrings->Length != 3)
return nullptr;
MyForm2 ^mf2 = gcnew MyForm2();
if (parsedStrings[1] != System::String::Empty)
mf2->Name = parsedStrings[1];
if (parsedStrings[2] != System::String::Empty)
mf2->Text = parsedStrings[2];
return mf2;
}
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
System::String^ path = Path::Combine(Path::GetDirectoryName(Application::ExecutablePath), "DockPanel.config");
DeserializeDockContent ^m_deserializeDockContent = gcnew DeserializeDockContent(GetContentFromPersistString);
dockPanel1->LoadFromXml(path, m_deserializeDockContent); }
An unhandled exception of type 'System.NullReferenceException' occurred in WeifenLuo.WinFormsUI.Docking.dll
Additional information: Object reference not set to an instance of an object.
I used
this example code from C# (DockSample Project)
What I have tried:
using FileStream ^fs1 = gcnew FileStream(path, FileMode::Open,FileAccess::Read);
Stream ^s1 = fs1; instead of System::String