Got another question, tho'
I am creating a method that receives two shapes and connects them programmatically.
How can I do that?
Is there any visio function that can draw that connection given the two shapes?
Are you taking about a 3x3 matrix or a matrix of type 3x3x3? For that later you wuold have to approach the process through the Gram-Schmit Orthonormalization method. A google search reveals various articles on how to work with matrices of three dimensions.
The .NET Framework versions are both forward and backward compatible to a degree. If you use a new method (or whatever) introduced in a new version while running against an older version where that method (or whatever) isn't defined, you'll get an exception like a TypeLoadException. If you use an obsolete/deprecated method in an older framework that no longer exists in the newer framework, you'll get an exception (this is far less common, but still happens).
I have a xml-document and i place it in a datagrid with a dataset. One column is named "numbers". When i load the xml-document into the datagrid, the column looks like this 6,3,2,1,5,8 and when i press the column (the header) he arranges them nicely 1,2,3,5,6,8. But when i save the dataset (dataset.WriteXml(filepath)) and load it again nothing has changed, it's back to 6,3,2,1,5,8.
How can i save this?
Personally, I'd use XSLT. You can easily write a template section that handles everything else and outputs it as-is while sorting the data you want using the sort element inside an apply-templates element. It certainly be a heck of a lot easier and would de-couple your code from sorting the XML data so that you could always transform it differently later by changing the XSLT document.
The XSLT Transform is handled completely by the .NET Framework so it will work on different computers, you just need to either use a file that you deploy with your application - using it from the Application.StartupPath or something - or embed it as a resource, get the stream using Assembly.GetManifestResourceStream, and load a Stream into both your XmlDocument (or XmlDataDocument, which works hand-in-hand with a DataSet nicely) and your XslTransform and then transform it using an appropriate Transform method. Note, the method you're currently using (with those parameters) is obsolete in .NET 1.1, so I suggest you see the documentation for the Transform Method[^] in the .NET Framework SDK for more information. If you use non-obsolete classes, members, etc. in your 1.0 application, it could be made to run under .NET 1.1 if 1.0 was not installed on a client machine.
You didn't declare the XML namespace for the "xsl" prefix in your stylesheet.
Also - like I mentioned - you don't need to save your XSLT to a file. You can save it to a stream and not have to worry about access permissions (the user may not be able to write files to the C:\ directory - besides, you should actually use Path.GetTempPath to get the user's TEMP directory).
It is better to create your XSLT as part of your application (as a project file) and set the Build Action to "Embedded Resource"). Then you only need to do something like this:
using (Stream s =
if (s != null)
XslTransform xsl = new XslTransform();
XmlDocument xml = new XmlDocument();
xsl.Transform(xml, Path.Combine(Path.GetTempPath(), "Output.xml"));
thx for your help and sorry to disturb you again but with the code you gave ma i get some mistakes i don't know
The best overloaded method match for'System.Xml.Xsl.XslTransform.Load(System.Xml.XmlReader)' has some invalid arguments<br />
Argument '1': cannot convert from'System.IO.Stream' to 'System.Xml.XmlReader'<br />
The best overloaded method match for'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList)' has some invalid arguments<br />
Argument '2': cannot convert from'string' to 'System.Xml.Xsl.XsltArgumentList'
It's because it was an example written very quickly and it's easy to solve if you look at the documentation for the XslTransform.Load method:
Stream s = this.GetType().Assembly.GetManifestResourceStream(
"MyRootNamespace.MyTransform.xslt"); // ONLY AN EXAMPLE
XmlReader reader = new XmlTextReader(s);
XmlWriter writer = new XmlTextWriter(
xsl.Transform(xml, null, writer);
Okay, the situation is this: I saved a Bitmap using the Bitmap.Save method into a MemoryStream and then I used the MemoryStream.ToArray() method to turn it into a Byte array. I used a Socket to send the the Byte (buffer) and recieved the buffer in a remote side (Mostly on a Pocket PC), I cannot seem to find a way to return that Byte back to a Bitmap, I tried using the MemoryStream(Byte) constructor in order to save it on a memory stream, and then using the Bitmap(System.IO.Stream) constructor but it returns an exception stating that it is an invalid parameter or argument, I would thank all who could help me solve this problem, here's an example of what I have been doing to send and recieve my Bitmap:
Bitmap bmp = new Bitmap(@openDialog1.FileName);
System.IO.MemoryStream memImage = new MemoryStream();
byte data = memImage.ToArray();
IPEndPoint endPoint = new IPEndPoint(this.theIP,651); //this.theIP = my IP
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("..my Ip.."),651);
Socket connected = socket.Accept();
byte byteResponse = new byte;
MemoryStream memory = new MemoryStream(byteResponse);
Bitmap bmp = new Bitmap(memory); //generates invalid argument exception
this.pictureBox1.Image = bmp;
Could anyone help me and also point out my errors here, I would be a great help, thanks in advanced.
P.S. I really would prefer a method that would work in the Compact Framework, since I am working with a Pocket PC as a reciever.
Last Visit: 31-Dec-99 19:00 Last Update: 28-Nov-22 14:25