jviana Posted May 26, 2012 at 06:27 PM Report #458246 Posted May 26, 2012 at 06:27 PM Boas, quando adiciono uma novo item ao meu arquivo .xml, ele não me adiciona e não sei porque. Código que uso para criar o arquivo. Sub pastaxml() System.IO.Directory.CreateDirectory(pasta) Dim xmlw As New XmlTextWriter(bdFile, System.Text.Encoding.UTF8) xmlw.Formatting = Formatting.Indented xmlw.WriteStartDocument() xmlw.WriteStartElement("musicas") xmlw.WriteEndElement() xmlw.WriteEndDocument() xmlw.Flush() xmlw.Close() End Sub Código que uso para adicionar o novo item: Form1.numero = Form1.numero + 1 nome = TextBox1.Text compositor = TextBox2.Text prgutilizado = TextBox3.Text ano = TextBox4.Text arranjo = TextBox5.Text tipo = ComboBox1.Text ficheiro = TextBox7.Text pdf = TextBox7.Text Dim xDoc = XDocument.Load(Form1.bdFile) Dim parent = xDoc.<musicas>.FirstOrDefault() Dim element = <musicas id=<%= numero %> nome=<%= nome %> compositor=<%= compositor %> programautilizado=<%= prgutilizado %> ano=<%= ano %> arranjo=<%= arranjo %> tipo=<%= arranjo %> ficheiro=<%= ficheiro %> pdf=<%= pdf %>/> parent.Add(element) Alguém me pode diz o que estou a fazer de errado? Obrigado Learning VB.Net HTML C/C++
jviana Posted May 27, 2012 at 02:20 PM Author Report #458366 Posted May 27, 2012 at 02:20 PM xDoc.Save(bdfile) Faltava isto, obrigado pela ajuda Learning VB.Net HTML C/C++
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now