Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Reading xml into a Dataset for a PDA.

Posted on 2006-10-26
2
Medium Priority
?
237 Views
Last Modified: 2010-04-16
I'm new to .NET and this is my first app but
I keep on getting an error I can't seem to find any help on.
The error reads :
"Could not find resource assembly"

Can anyone help me on this problem and maybe show me a solution?

This is the code :

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using System.IO;

namespace Test4
{
      /// <summary>
      /// Summary description for Form1.
      /// </summary>
      public class Form1 : System.Windows.Forms.Form
      {
            private System.Windows.Forms.ComboBox comboBox1;
            DataSet companyDS;
            string xmlFileName;
            string xsdFileName;
            private System.Windows.Forms.TextBox txtbox;
            public Form1()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();
                  companyDS = new DataSet();

                  // Set file names and create file streams
                  xmlFileName = "\\My Documents\\Company.xml";
                  xsdFileName = "\\My Documents\\Company.xsd";
                  FileStream FsXML = new FileStream(xmlFileName,FileMode.Open);
                  FileStream FsXSD = new FileStream(xsdFileName,FileMode.Open);

                  try
                  {      
                  // Load the data into the DataSet.
                        XmlTextReader xtrXML = new XmlTextReader(FsXML);
                        companyDS.ReadXml(xtrXML);
                        xtrXML.Close();                                      <- I get an error here
                        FsXML.Close();

                  // Load the schema into the DataSet.
                  
                        XmlTextReader xtrXSD = new XmlTextReader(FsXSD);
                        companyDS.ReadXmlSchema(xtrXSD);
                        xtrXSD.Close();
                        FsXSD.Close();
                  
                  // Get a DataTable to conveniently use for binding.
                  DataTable dt = companyDS.Tables["record"];

                  //Bind the list box to state abreviations.
                  comboBox1.DataSource = dt;
                  comboBox1.DisplayMember = "Mines";
         
                  //Bind the text box for entering data.
                  txtbox.DataBindings.Add(new Binding("Text",dt,"MineID"));
                  //
                  // TODO: Add any constructor code after InitializeComponent call
                  //
                  }
                  catch (Exception e)
                  {
                        MessageBox.Show(e.Message,"Exception");
                  }
            }
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  base.Dispose( disposing );
            }
            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.comboBox1 = new System.Windows.Forms.ComboBox();
                  this.txtbox = new System.Windows.Forms.TextBox();
                  //
                  // comboBox1
                  //
                  this.comboBox1.Location = new System.Drawing.Point(8, 40);
                  this.comboBox1.Size = new System.Drawing.Size(176, 21);
                  //
                  // txtbox
                  //
                  this.txtbox.Location = new System.Drawing.Point(40, 120);
                  this.txtbox.Size = new System.Drawing.Size(112, 20);
                  this.txtbox.Text = "textBox1";
                  //
                  // Form1
                  //
                  this.ClientSize = new System.Drawing.Size(194, 280);
                  this.Controls.Add(this.txtbox);
                  this.Controls.Add(this.comboBox1);
                  this.Text = "READ XML";

            }
            #endregion

            /// <summary>
            /// The main entry point for the application.
            /// </summary>

            static void Main()
            {
                  Application.Run(new Form1());
            }
      }
}

Many Thanks
0
Comment
Question by:argus42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
redpipe earned 1000 total points
ID: 17810066
Check that you have a reference to the System.Xml library.

In SolutionExplorer look for subitem "References" to your project and expand it. If "System.Xml" is not shown, add it by right-clicking the meny and choose "Add reference". On the ".Net" tab browse down to you find the "System.Xml" library, select it and click "OK". Try building your project again...
0
 

Author Comment

by:argus42
ID: 17810107
System.Xml is there.
I did it again and built the project again.
I get the same error.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question