Hello,
I have a need to clone the layout of a grid on a form. I thought it would be simple to just save the layout using the code below.
Dim stream As New System.IO.MemoryStream
ugOriginal.DisplayLayout.SaveAsXml(stream, PropertyCategories.All)
UGNew.DisplayLayout.LoadFromXml(stream, PropertyCategories.All)
Whenever I run this, the loadfromxml is throwing a system.xml.xmlexception: root element is missing.
Would you have a simple example for me to follow. I do not want to write the xml to disk (which I tried and still go this error.) Thank you for your time.
This is a guess, but try setting the Position of the stream to 0 before trying to load from it (but after saving to it).
-Matt
You are a genius. That was it.
Also noticed...you must bind the grid to the datasource first, then apply the displaylayout.
Thank you for your quick response.