|
I'm using the methods Shape.SetBegin and Shape.SetEnd. But they don't seem to connect just fine.
|
|
|
|
|
This works:
Cell vsoCellGlueFromBegin = oShapeConnector.get_Cells("BeginX");
Cell vsoCellGlueFromEnd = oShapeConneor.get_Cells("EndX") ;
Cell vsoCellGlueToObject = oShape1.get_Cells("Connections.X");
Cell vsoCellGlueToObject2 = oShape2.get_Cells("Geometry1.X1");
vsoCellGlueFromBegin.GlueTo(vsoCellGlueToObject);
vsoCellGlueFromEnd.GlueTo(vsoCellGlueToObject2);
For whom it may concern.
|
|
|
|
|
This works:
Cell vsoCellGlueFromBegin = oShapeConnector.get_Cells("BeginX");
Cell vsoCellGlueFromEnd = oShapeConneor.get_Cells("EndX") ;
Cell vsoCellGlueToObject = oShape1.get_Cells("Connections.X1");
Cell vsoCellGlueToObject2 = oShape2.get_Cells("Connections.X1");
vsoCellGlueFromBegin.GlueTo(vsoCellGlueToObject);
vsoCellGlueFromEnd.GlueTo(vsoCellGlueToObject2);
For whom it may concern.
|
|
|
|
|
hi
i have problem in matrix determinant in 3d matrix so i want
to know how can i solve this programme of finding the
determinant in 3d matrix
bye
matrix determinant in 3*3d
|
|
|
|
|
|
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.
|
|
|
|
|
I have a translation program called .net Framwork1.1. If it's running in .net Framwork 1.1, would there any error ocurr ?
does .net Framwoek is compatibled
study everyday
|
|
|
|
|
Uhhh....You have a what?
I take it you have a program written for the .NET Framework 1.1?
RageInTheMachine9532
|
|
|
|
|
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).
Read both Deploying Applications[^] and Configuring Applications[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
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?
thx in advance
|
|
|
|
|
The view of the data is changed, not the actual data (in reference to DataSet s and DataTable s, the DataView is what's changed).
If you need to sort your data, then you can use XPath navigation or XSLT transforms which makes sorting easy work.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
if i use the Xpath navigation, i should use XPathNavigator to select the nodes and XPathNodeIterator to walk through them? How do i move a node then?
|
|
|
|
|
Write them out as you iterate through them.
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i'm trying to do what you said but i'm really new to this so it takes a while to make it. Now i have my xml file and i have a xsl file that looks like this:
<xsl:stylesheet version="1.0">
<xsl:output method="text"/>
<xsl:template match="libraries">
<xsl:apply-templates>
<xsl:sort select="loadorder"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
is this any good? how do i call this now in c#?
thx in advance
|
|
|
|
|
i think i got it
XslTransform test = new XslTransform();<br />
test.Load(@"c:\xslt.xsl");<br />
test.Transform(@"c:\file",@"c:\file2");
if forgot to say that it's not possible to just have a xsl-file because my program has to work on different computers
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i'm doing it now like this:
string xsl = "<xsl:stylesheet version=\"1.0\">" + "<xsl:output method=\"text\"/> " +
"<xsl:template match=\"//libraries\"> " +
" <xsl:apply-templates>"+
"<xsl:sort select=\"//loadorder\"/>"+
"</xsl:apply-templates>"+
"</xsl:template>"+
"</xsl:stylesheet>";
StreamWriter sw = File.CreateText(@"c:\xslt.xsl");
sw.WriteLine(xsl);
sw.Close();
XslTransform test = new XslTransform();
test.Load(@"c:\xslt.xsl");
test.Transform(@"c:\sessions.conf.xml",@"c:\sorted.xml");
but i'm getting a error (on the transform):
An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll
Additional information: System error.
|
|
|
|
|
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 =
this.GetType().Assembly.GetManifestResourceStream("MyRootNamespace.File.xslt"))
{
if (s != null)
{
XslTransform xsl = new XslTransform();
xsl.Load(s);
XmlDocument xml = new XmlDocument();
xml.Load();
xsl.Transform(xml, Path.Combine(Path.GetTempPath(), "Output.xml"));
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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
<br />
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 />
<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");
XmlReader reader = new XmlTextReader(s);
XmlWriter writer = new XmlTextWriter(
Path.Combine(Path.GetTempPath(), "Output.xml"),
Encoding.UTF8);
xsl.Transform(xml, null, writer);
writer.Close();
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i just can't make it work it's getting very frustrating
i tried it now it what seems the most easy way to me:
string filePath = @"c:\nodes.xml";
string filePath2 = @"c:\XSL2.xsl";
XslTransform trans = new XslTransform();
trans.Load(filePath2);
trans.Transform(filePath,@"c:\ert.xml");
the xml file looks like this:
<sessie name="handel">
<libraries>
<library name="contxtlib">
<fullname>123</fullname>
<super>false</super>
<loadorder>1</loadorder>
</library>
<library name="xmllib">
<fullname>xmllib.p</fullname>
<super>true</super>
<loadorder>6</loadorder>
</library>
<library name="Librarytest">
<fullname>Test 44444444444</fullname>
<super>false</super>
<loadorder>5</loadorder>
</library>
<library name="vbnc">
<fullname>bvcn</fullname>
<super>true</super>
<loadorder>3</loadorder>
</library>
</libraries>
</sessie>
and the XSL looks like this:
<xsl:stylesheet version="1.0">
<xsl:output method="text"/>
<xsl:template match="//libraries">
<xsl:apply-templates>
<xsl:sort select="/library/loadorder"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
and it just won't work
|
|
|
|
|
never mind what i said, i give up
i'm just going to use a dataview and sort it like that
thx a lot for your help
|
|
|
|
|
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:
//Sending:
Bitmap bmp = new Bitmap(@openDialog1.FileName);
System.IO.MemoryStream memImage = new MemoryStream();
bmp.Save(memImage,System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] data = memImage.ToArray();
IPEndPoint endPoint = new IPEndPoint(this.theIP,651); //this.theIP = my IP
socket.Connect(endPoint);
socket.Send(data,0,data.Length,SocketFlags.None);
//Recieving
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("..my Ip.."),651);
this.socket.Bind(endPoint);
this.socket.Listen(10);
Socket connected = socket.Accept();
byte[] byteResponse = new byte[1024];
connected.Receive(byteResponse,SocketFlags.None);
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.
|
|
|
|
|
Hi Gakujin,
To construct an image object (in your case a Bitmap, which is derived from Image) from a MemoryStream object use the Image.FromStream static method.
so simply replace:
Bitmap bmp = new Bitmap(memory);
with
Image img = Image.FromStream(memory);
I am not sure about the compact framework, but I presume loading from a stream should work, since you can save to a stream already.
EDIT: Sorry I didn't notice that the Bitmap constructor already does this, so ignore me 
|
|
|
|
|
Yes, you would have to use the Bitmap constructor since Image.FromStream is not supported on .NET CF. Just FYI
Microsoft MVP, Visual C#
My Articles
|
|
|
|