十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1.先在窗体放置两个pane,pane1的Dock属性是Left,pane2是fill
目前创新互联已为成百上千家的企业提供了网站建设、域名、网页空间、绵阳服务器托管、企业网站设计、石楼网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
2.再添加两个pane,分别为pane3,pane4,把她们添加到pane2里面
3.再添加两个button,放置到pane1里面
4.往pane3和pane4中分别放点不同的东西
5.然后button的事件是:
private void button1_Click(object sender, EventArgs e)
{
this.panel3.Visible = true;
this.panel4.Visible = false;
}
private void button2_Click(object sender, EventArgs e)
{
this.panel3.Visible = false;
this.panel4.Visible = true;
}
大概都是这么实现的,具体的效果还需要丰富
我以前也研究过vista优化大师的效果
也仿照出来了,如果你需要源代码,可以写上你的邮箱,我给你发过去
你的xml文字有错误,正确的如下: ?xml version="1.0"? grouplist group name="1" server name="1.1"/ server name="2.2"/ /group group name="2" server name="2.1"/ server name="2.2"/ /group /grouplist 以下是在vs2008下调试成功 Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim tvw As TreeView Dim x As New Xml.XmlDocument Dim nd As Xml.XmlNode Dim pcnd As TreeNode Dim I As Integer Dim II As Integer tvw = New TreeView tvw.Parent = Me tvw.SetBounds(10, 10, 300, 300) x.Load("该处为xml文件路径") '如 C:\\abc.xml For I = 1 To x.DocumentElement.ChildNodes.Count nd = x.DocumentElement.ChildNodes(I - 1) pcnd = tvw.Nodes.Add("G" I.ToString, nd.Attributes(0).Value) For II = 1 To nd.ChildNodes.Count pcnd.Nodes.Add(nd.ChildNodes(II - 1).Attributes(0).Value) Next pcnd.Expand() Next End Sub End Class
希望采纳
使用System.XML
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Xml
namespace HowTo.Samples.XML
public class WriteXmlFileSample
private const document as string = "newbooks.xml"
shared sub Main()
Dim myWriteXmlFileSample as WriteXmlFileSample
myWriteXmlFileSample = new WriteXmlFileSample()
myWriteXmlFileSample.Run(document)
end sub
public sub Run(args As String)
Dim myXmlTextReader as XmlTextReader = nothing
Dim myXmlTextWriter as XmlTextWriter = nothing
try
myXmlTextWriter = new XmlTextWriter (args, nothing)
myXmlTextWriter.Formatting = System.Xml.Formatting.Indented
myXmlTextWriter.WriteStartDocument(false)
myXmlTextWriter.WriteDocType("bookstore", nothing, "books.dtd", nothing)
myXmlTextWriter.WriteComment("此文件表示书店库存数据库的另一个片断")
myXmlTextWriter.WriteStartElement("bookstore")
myXmlTextWriter.WriteStartElement("book", nothing)
myXmlTextWriter.WriteAttributeString("genre","autobiography")
myXmlTextWriter.WriteAttributeString("publicationdate","1979")
myXmlTextWriter.WriteAttributeString("ISBN","0-7356-0562-9")
myXmlTextWriter.WriteElementString("title", nothing, "The Autobiography of Mark Twain")
myXmlTextWriter.WriteStartElement("Author", nothing)
myXmlTextWriter.WriteElementString("first-name", "Mark")
myXmlTextWriter.WriteElementString("last-name", "Twain")
myXmlTextWriter.WriteEndElement()
myXmlTextWriter.WriteElementString("price", "7.99")
myXmlTextWriter.WriteEndElement()
myXmlTextWriter.WriteEndElement()
'向文件写 XML 并关闭编写器
myXmlTextWriter.Flush()
myXmlTextWriter.Close()
' 读取返回的文件并进行分析以确保正确生成 XML
myXmlTextReader = new XmlTextReader (args)
FormatXml (myXmlTextReader, args)
catch e as Exception
Console.WriteLine ("异常:{0}", e.ToString())
finally
Console.WriteLine()
Console.WriteLine("对文件 {0} 的处理已完成。", args)
If Not myXmlTextReader Is Nothing
myXmlTextReader.Close()
end if
'关闭编写器
If Not myXmlTextWriter Is Nothing
myXmlTextWriter.Close()
end if
End try
End Sub
private shared Sub FormatXml (reader as XmlTextReader, filename as String)
Dim piCount, docCount, commentCount, elementCount as Integer
Dim attributeCount, textCount, whitespaceCount as Integer
While reader.Read()
Select (reader.NodeType)
case XmlNodeType.ProcessingInstruction:
Format (reader, "ProcessingInstruction")
piCount += 1
case XmlNodeType.DocumentType:
Format (reader, "DocumentType")
docCount += 1
case XmlNodeType.Comment:
Format (reader, "Comment")
commentCount += 1
case XmlNodeType.Element:
Format (reader, "Element")
elementCount += 1
While reader.MoveToNextAttribute()
Format (reader, "Attribute")
end While
if (reader.HasAttributes)
attributeCount += reader.AttributeCount
end if
case XmlNodeType.Text:
Format (reader, "Text")
textCount += 1
case XmlNodeType.Whitespace:
whitespaceCount += 1
End Select
End While
' 显示该文件的统计信息
Console.WriteLine ()
Console.WriteLine("{0} 文件的统计信息", filename)
Console.WriteLine ()
Console.WriteLine("处理指令:" piCount)
Console.WriteLine("文档类型:" docCount)
Console.WriteLine("注释:" commentCount)
Console.WriteLine("元素:" elementCount)
Console.WriteLine("属性:" attributeCount)
Console.WriteLine("文本:" textCount)
Console.WriteLine("空白:" whitespaceCount)
End Sub
private shared Sub Format(byref reader as XmlTextReader , NodeType as String)
' 格式化输出
Console.Write(reader.Depth " ")
Console.Write(reader.AttributeCount " ")
Dim i as Integer
for i = 0 to reader.Depth - 1
Console.Write(Strings.chr(9))
Next
Console.Write(reader.Prefix NodeType "" reader.Name "" reader.Value)
Console.WriteLine()
End Sub
End Class
End Namespace
参考:
DataSet 和 DataTable都有现成的方法:WriteXml
DataTable tb = this.dataGridView1.DataSource as DataTable;
if(tb != null)
{
tb.WriteXml(@"C:\table.xml",true);
return;
}
DataView dv = this.dataGridView1.DataSource as DataView;
if(dv != null)
{
dv.Table.WriteXml(@"C:\table.xml",true);
return;
}
IList list = this.dataGridView1.DataSource as IList;
if(list != null)
{
//to do,如果是IList,就要你自己想办法导出了
//XmlDocument or XmlWriter都可以考虑
}
有多种方法.
如果是vb.net,则其本身就有xml编辑支持,具有xml系统类,可以直接调用,再配合了listview来进行可视化处理。
如果是vb 6.0
则可以借助外部的控件,或者别人做好的控件。
其实xml也是一种可编辑的纯文本格式。
你可以在vb里用richtextbox的load方法加载,然后自己用find方法分析,在列出树形图。
把XML看成一棵树吧..用xmldocument操作,,,这里有参考的
有点难度噢...