Embedded Xml: Ok it work, but ... why?
-
Hi, I have png and xml files embedded in a project. I can access them with the code bellow.
DataSet MyDataSet = new DataSet();
Assembly ThisAssembly = Assembly.GetExecutingAssembly();
// assign a image png to button
Stream Stream_Image = ThisAssembly.GetManifestResourceStream("MyProject.Resources.info.png");
Button_Info.Image = Image.FromStream(Stream_Image);// assign table to DataGridView
Stream Stream_Xml = ThisAssembly.GetManifestResourceStream("MyProject.Resources.users.xml");
MyDataSet.ReadXml(Stream_Xml); // why does this work???
DataGridView_Report.DataSource = MyDataSet.Tables[0];OK. For the png i got it, but ... for the xml why does it work? :doh:
MyDataSet.ReadXml(Application.StartupPath + "\\...\\users.xml", XmlReadMode.ReadSchema));
This i understand, (not embedded although) the path way, here i really reading a xml not a stream.
nelsonpaixao@yahoo.com.br trying to help & get help
-
Hi, I have png and xml files embedded in a project. I can access them with the code bellow.
DataSet MyDataSet = new DataSet();
Assembly ThisAssembly = Assembly.GetExecutingAssembly();
// assign a image png to button
Stream Stream_Image = ThisAssembly.GetManifestResourceStream("MyProject.Resources.info.png");
Button_Info.Image = Image.FromStream(Stream_Image);// assign table to DataGridView
Stream Stream_Xml = ThisAssembly.GetManifestResourceStream("MyProject.Resources.users.xml");
MyDataSet.ReadXml(Stream_Xml); // why does this work???
DataGridView_Report.DataSource = MyDataSet.Tables[0];OK. For the png i got it, but ... for the xml why does it work? :doh:
MyDataSet.ReadXml(Application.StartupPath + "\\...\\users.xml", XmlReadMode.ReadSchema));
This i understand, (not embedded although) the path way, here i really reading a xml not a stream.
nelsonpaixao@yahoo.com.br trying to help & get help
There isn't really any difference between PNG data and XML data, it's only a bunch of bytes. Reading a stream of bytes as a PNG image or reading a stream of bytes as an XML document makes no difference for the stream that you are reading from.
Despite everything, the person most likely to be fooling you next is yourself.
-
Hi, I have png and xml files embedded in a project. I can access them with the code bellow.
DataSet MyDataSet = new DataSet();
Assembly ThisAssembly = Assembly.GetExecutingAssembly();
// assign a image png to button
Stream Stream_Image = ThisAssembly.GetManifestResourceStream("MyProject.Resources.info.png");
Button_Info.Image = Image.FromStream(Stream_Image);// assign table to DataGridView
Stream Stream_Xml = ThisAssembly.GetManifestResourceStream("MyProject.Resources.users.xml");
MyDataSet.ReadXml(Stream_Xml); // why does this work???
DataGridView_Report.DataSource = MyDataSet.Tables[0];OK. For the png i got it, but ... for the xml why does it work? :doh:
MyDataSet.ReadXml(Application.StartupPath + "\\...\\users.xml", XmlReadMode.ReadSchema));
This i understand, (not embedded although) the path way, here i really reading a xml not a stream.
nelsonpaixao@yahoo.com.br trying to help & get help
There is no difference at all. When you pass a path it goes and opens the file (which ends up as a stream), and when you pass it a stream - well, its already a stream. A stream is just a pile of data, in memory, on your hard disk, coming over a network; it's all quite similar.
My current favourite word is: Nipple!
-SK Genius
-
Hi, I have png and xml files embedded in a project. I can access them with the code bellow.
DataSet MyDataSet = new DataSet();
Assembly ThisAssembly = Assembly.GetExecutingAssembly();
// assign a image png to button
Stream Stream_Image = ThisAssembly.GetManifestResourceStream("MyProject.Resources.info.png");
Button_Info.Image = Image.FromStream(Stream_Image);// assign table to DataGridView
Stream Stream_Xml = ThisAssembly.GetManifestResourceStream("MyProject.Resources.users.xml");
MyDataSet.ReadXml(Stream_Xml); // why does this work???
DataGridView_Report.DataSource = MyDataSet.Tables[0];OK. For the png i got it, but ... for the xml why does it work? :doh:
MyDataSet.ReadXml(Application.StartupPath + "\\...\\users.xml", XmlReadMode.ReadSchema));
This i understand, (not embedded although) the path way, here i really reading a xml not a stream.
nelsonpaixao@yahoo.com.br trying to help & get help
Ok then i got it. The more i know the more i realize i dont know :laugh: thanks
nelsonpaixao@yahoo.com.br trying to help & get help