当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·dll文件为何不能使用    »显示摘要«
    摘要: 我在vs中编译生成了一个dll文件,想在asp.net中使用,并将其放到根目录下的bin子目录下,在浏览aspx文件的时候,总提示找到程序集但定义不正确。而我的源文件中有admin的名字空间和一个adminuser的类,生成dll的名字为admin。请教是何原因?谢谢! ......
 ·网络通讯问题求助(100分相赠)    »显示摘要«
    摘要: 我用的是xp系统,遇到了这样的问题:我用的是局逾网,能ping通192.168.1.1(默认网关),但找不到dns服务器.用nslookup时显示time out.与我用同一基线器的其他用户能上网.ping自己能通.dhcp显示以自动分配ip.在98下没问题.请问怎么解决? ......


请大家帮忙,运行时出错,“这是一个意外的XML声明。。。”

using   System;  
  using   System.Drawing;  
  using   System.Collections;  
  using   System.ComponentModel;  
  using   System.Windows.Forms;  
  using   System.Data;  
   
  using   System.Xml;  
  using   System.Diagnostics;  
  using   System.IO;  
   
   
  namespace   EmployeeRecords  
  {  
  ///   <summary>  
  ///   Summary   description   for   Form1.  
  ///   </summary>  
  public   class   EmployeeRecordsForm   :   System.Windows.Forms.Form  
  {  
  private   System.Windows.Forms.TreeView   treeView1;  
  private   System.Windows.Forms.ListView   listView1;  
  private   System.Windows.Forms.StatusBar   statusBar1;  
  private   System.Windows.Forms.StatusBarPanel   statusBarPanel1;  
  ///   <summary>  
  ///   Required   designer   variable.  
  ///   </summary>  
  private   System.ComponentModel.Container   components=null;  
   
  private   TreeNode   tvRootNode;  
   
   
  public   EmployeeRecordsForm()  
  {  
  //  
  //   Required   for   Windows   Form   Designer   support  
  //  
  InitializeComponent();  
   
  //  
  //   TODO:   Add   any   constructor   code   after   InitializeComponent   call  
  //  
  PopulateTreeView();  
  initializeListControl();  
   
  }  
   
  ///   <summary>  
  ///   Clean   up   any   resources   being   used.  
  ///   </summary>  
  protected   override   void   Dispose(   bool   disposing   )  
  {  
  if(   disposing   )  
  {  
  if   (components   !=   null)    
  {  
  components.Dispose();  
  }  
  }  
  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.treeView1   =   new   System.Windows.Forms.TreeView();  
  this.listView1   =   new   System.Windows.Forms.ListView();  
  this.statusBar1   =   new   System.Windows.Forms.StatusBar();  
  this.statusBarPanel1   =   new   System.Windows.Forms.StatusBarPanel();  
  ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();  
  this.SuspendLayout();  
  //    
  //   treeView1  
  //    
  this.treeView1.ImageIndex   =   -1;  
  this.treeView1.Name   =   "treeView1";  
  this.treeView1.SelectedImageIndex   =   -1;  
  this.treeView1.Size   =   new   System.Drawing.Size(240,   352);  
  this.treeView1.TabIndex   =   0;  
  this.treeView1.AfterSelect   +=   new   System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);  
  //    
  //   listView1  
  //    
  this.listView1.Activation   =   System.Windows.Forms.ItemActivation.TwoClick;  
  this.listView1.Location   =   new   System.Drawing.Point(240,   0);  
  this.listView1.Name   =   "listView1";  
  this.listView1.Size   =   new   System.Drawing.Size(480,   352);  
  this.listView1.TabIndex   =   1;  
  this.listView1.View   =   System.Windows.Forms.View.Details;  
   
  //    
  //   statusBar1  
  //    
  this.statusBar1.Location   =   new   System.Drawing.Point(0,   357);  
  this.statusBar1.Name   =   "statusBar1";  
  this.statusBar1.Panels.AddRange(new   System.Windows.Forms.StatusBarPanel[]   {  
      this.statusBarPanel1});  
  this.statusBar1.ShowPanels   =   true;  
  this.statusBar1.Size   =   new   System.Drawing.Size(720,   24);  
  this.statusBar1.TabIndex   =   2;  
  //    
  //   statusBarPanel1  
  //    
  this.statusBarPanel1.Text   =   "Click   the   employee   code   to   view   details";  
  this.statusBarPanel1.Width   =   720;  
  //    
  //   EmployeeRecordsForm  
  //    
  this.AutoScaleBaseSize   =   new   System.Drawing.Size(5,   13);  
  this.AutoScroll   =   true;  
  this.ClientSize   =   new   System.Drawing.Size(720,   381);  
  this.Controls.AddRange(new   System.Windows.Forms.Control[]   {  
      this.statusBar1,  
      this.listView1,  
      this.treeView1});  
  this.MaximizeBox   =   false;  
  this.MinimizeBox   =   false;  
  this.Name   =   "EmployeeRecordsForm";  
  this.Text   =   "Employee   Records   Monitoring   System";  
  ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();  
  this.ResumeLayout(false);  
   
  }  
  #endregion  
   
  ///   <summary>  
  ///   The   main   entry   point   for   the   application.  
  ///   </summary>  
  [STAThread]  
  static   void   Main()    
  {  
  Application.Run(new   EmployeeRecordsForm());  
  }  
   
  protected   void   PopulateTreeView()  
  {  
  statusBarPanel1.Text="Refreshing   Employee   Codes.   Please   wait...";  
  this.Cursor   =   Cursors.WaitCursor;  
  treeView1.Nodes.Clear();  
  tvRootNode=new   TreeNode("Employee   Records");  
  this.Cursor   =   Cursors.Default;  
  treeView1.Nodes.Add(tvRootNode);  
   
  TreeNodeCollection   nodeCollect   =   tvRootNode.Nodes;  
  string   strVal="";  
  XmlTextReader   reader=   new   XmlTextReader("E:\\BookProj\\EmpRec.xml");  
   
  reader.MoveToElement();  
   
  try  
  {  
  while(reader.Read())//reader.Read()  
  {  
  if(reader.HasAttributes   &&   reader.NodeType==XmlNodeType.Element)  
  {  
  reader.MoveToElement();  
  reader.MoveToElement();  
  reader.MoveToAttribute("Id");  
  strVal=reader.Value;  
  reader.Read();  
  reader.Read();  
   
  if(reader.Name=="Dept")    
  {  
  reader.Read();  
   
  }  
   
  //create   the   child   nodes  
  TreeNode   EcodeNode   =   new   TreeNode(strVal);  
  // Add   the   Node    
  nodeCollect.Add(EcodeNode);    
  }  
  }  
  statusBarPanel1.Text="Click   on   an   employee   code   to   see   their   record.";  
  }  
  catch(XmlException   e)  
  {  
  MessageBox.Show("XML   Exception   :"+e.ToString());  
  }  
  }  
   
   
  protected   void   initializeListControl()    
  {  
  listView1.Clear();  
  listView1.Columns.Add("Employee   Name",225,HorizontalAlignment.Left   );  
  listView1.Columns.Add("Date   of   Join",70,HorizontalAlignment.Right   );  
  listView1.Columns.Add("Grade",105,HorizontalAlignment.Left   );  
  listView1.Columns.Add("Salary",105,HorizontalAlignment.Left   );  
  }  
   
  protected   void   PopulateListView(TreeNode   currNode)  
  {  
  initializeListControl();  
   
  XmlTextReader   listRead=   new   XmlTextReader("E:\\BookProj\\EmpRec.xml");  
  listRead.MoveToElement();  
   
  while(listRead.Read())  
  {  
  string   strNodename;  
  string   strNodePath;  
  string   name;  
  string   grade;  
  string   doj;  
  string   sal;  
  string[]   strItemsArr=new   String   [4];  
  listRead.MoveToFirstAttribute();  
  strNodename=listRead.Value;  
  strNodePath=currNode.FullPath.Remove(0,17);  
  if(strNodePath==strNodename)  
  {  
  ListViewItem   lvi;  
  listRead.MoveToNextAttribute();  
  name=listRead.Value;    
  lvi=listView1.Items.Add(name);      
  listRead.Read();  
  listRead.Read();  
  listRead.MoveToFirstAttribute();  
  doj=listRead.Value;  
  lvi.SubItems.Add(doj);    
  listRead.MoveToNextAttribute();  
  grade=listRead.Value;    
  lvi.SubItems.Add(grade);    
  listRead.MoveToNextAttribute();  
  sal=listRead.Value;    
  lvi.SubItems.Add(sal);    
   
   
  listRead.MoveToNextAttribute();  
  listRead.MoveToElement();  
  listRead.ReadString();  
  }  
  }  
  }  
   
  private   void   treeView1_AfterSelect(object   sender,   System.Windows.Forms.TreeViewEventArgs   e)  
  {  
   
  TreeNode   currNode   =   e.Node;  
  if   (tvRootNode   ==   currNode   )    
  {  
  initializeListControl();  
  statusBarPanel1.Text="Double   click   the   Employee   Records";  
  return;  
  }  
  else  
  {  
  statusBarPanel1.Text="Click   an   employee   code   to   view   individual   records";  
  }  
  PopulateListView(currNode);  
   
  }  
   
  }  
  }  
 

NO.1   作者: Knight94

报什么错?


 ·大家帮个忙加    »显示摘要«
    摘要: http://expert.csdn.net/expert/topic/1689/1689723.xml?temp=.5349085 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE