C#和Vb 关于 xml.load的疑问【顶者有分】
C# code:
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
string p = System.IO.Path.GetFullPath("Config.xml");
doc.Load(p);
string a = doc.GetElementsByTagName("Path").Item(0).InnerText.ToString();
string b = doc.GetElementsByTagName("CT7").Item(0).InnerText.ToString();
在 C#中 doc.Load(p)没有出错
VB code:
Dim doc As System.Xml.XmlDocument
Dim p As String = System.IO.Path.GetFullPath("Config.xml").ToString()
doc.Load(p)
Dim bb As String = doc.GetElementById("Directory").Item("CT7").InnerText.ToString()
在 VB中 doc.Load(p)却出错
出错:
Object reference not set to an instance of an object
完全一样的代码,为什么会有不同的结果?
别说时路径错误,路径完全正确
没人么- -!
人工置顶
如需要阅读该回复,请登录或注册CSDN!
相关问答:
为什么C写的DLL文件C、PB能调用VB不能调用?
VB里为什么有的DLL直接通过引用可以使用?有的需要通过declare申明外部函数?这些DLL有什么差别?
1、为什么PB能通过DECLARE声明而VB不行?
2、如果这个dll中的 ......
login.aspx.vb:
Public ReadOnly Property nameT() As String
Get
Return TextBox1.Text
&nb ......
请教一下:我用vb写了一个调用Illustrator的测试程序,代码很简单:Private Sub Command1_Click()
Dim app As New Illustrator.Application
Dim doc As Illustrator.Document
Dim thislayer As Illustrator.Layer ......
各位大虾:
我有一个VB调用水晶报表的系统,报表是作为一个Design嵌在VB里的,今天发现打印第一张报表正常,同样的数据,在点打印再调用一次就会报 Memory Full的错误,但是 ......