0% found this document useful (0 votes)
64 views8 pages

.NET XML Data Handling Guide

This document describes a .NET application that loads XML data into a data grid, allows editing the data, and saves the modified data back to XML or text formats. It includes code for opening an XML file, loading it into a dataset and displaying in a data grid. It also includes code for saving the data grid contents back to an XML or text file. The document includes screenshots of the application interface and samples of the XML and text files created.

Uploaded by

Felipe Faundez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views8 pages

.NET XML Data Handling Guide

This document describes a .NET application that loads XML data into a data grid, allows editing the data, and saves the modified data back to XML or text formats. It includes code for opening an XML file, loading it into a dataset and displaying in a data grid. It also includes code for saving the data grid contents back to an XML or text file. The document includes screenshots of the application interface and samples of the XML and text files created.

Uploaded by

Felipe Faundez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Acceso desconectado a Datos

Felipe Eduardo Faúndez Aguilar

Programación .NET II

Instituto IACC

18 Diciembre 2019
Desarrollo

Parte 1.

Código Fuente Aplicación.

Imports System.Xml
Imports System.IO
Public Class Form1
Private Sub CargarXML_Click(sender As Object, e As EventArgs) Handles
CargarXML.Click
OpenFileDialog1.Filter = "Archivo XML|*.xml"
If (OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK)
Then
Dim fileXML As XmlReader =
XmlReader.Create(OpenFileDialog1.FileName)
Dim dataset As New DataSet
dataset.ReadXml(fileXML)
DataGridView1.DataSource = dataset.Tables(0)
End If
DataGridView1.AutoResizeColumns()
DataGridView1.ReadOnly = True
End Sub

Private Sub GuardarTXT_Click(sender As Object, e As EventArgs) Handles


GuardarTXT.Click
If DataGridView1.Rows.Count <> 0 Then
Dim sw As New
StreamWriter("C:\Control8\actividades_FelipeFaundez.txt", True,
System.Text.Encoding.Default)
For x = 0 To DataGridView1.Rows.Count - 2
sw.WriteLine("Actividad N° " +
DataGridView1.Rows(x).Cells(0).Value.ToString)

sw.WriteLine("-------------------------------------------------------------------
---------------------")
sw.WriteLine(" Sala ID : " +
DataGridView1.Rows(x).Cells(4).Value.ToString)
sw.WriteLine(" Nombre de la actividad : " +
DataGridView1.Rows(x).Cells(1).Value.ToString)
sw.WriteLine(" Descrpción : " +
DataGridView1.Rows(x).Cells(3).Value.ToString)

sw.WriteLine("===================================================================
=====================")
sw.WriteLine("")
sw.WriteLine("")
Next
sw.Close()
MsgBox("Archivo guardado correctamente en:
C:\Control8\actividades_FelipeFaundez.txt")
Else
MsgBox("La grilla no contiene datos, favor cargue el archivo
XML")
End If
End Sub

Private Sub GuardarXML_Click(sender As Object, e As EventArgs) Handles


GuardarXML.Click
If DataGridView1.Rows.Count <> 0 Then
Dim numAleatorio As New Random()
Dim Writer As XmlWriter =
XmlWriter.Create("C:\Control8\actividades_FelipeFaundez.xml")

Writer.WriteStartDocument()
Writer.WriteStartElement("Actividades")
For x = 0 To DataGridView1.Rows.Count - 2
Writer.WriteStartElement("Actividad")
Writer.WriteElementString("id_actividad",
DataGridView1.Rows(x).Cells(0).Value.ToString)
Writer.WriteElementString("url",
DataGridView1.Rows(x).Cells(2).Value.ToString)
Writer.WriteElementString("nombre_de_la_actividad",
DataGridView1.Rows(x).Cells(1).Value.ToString)
Writer.WriteElementString("descripcion",
DataGridView1.Rows(x).Cells(3).Value.ToString)
Writer.WriteElementString("valor_de_la_entrada",
numAleatorio.Next(5000, 10000).ToString)
Writer.WriteEndElement()
Next
Writer.WriteEndDocument()
Writer.Close()
MsgBox("Archivo guardado correctamente en:
C:\Control8\actividades_FelipeFaundez.xml")
Else
MsgBox("La grilla no contiene datos, favor cargue el archivo
XML")
End If
End Sub

End Class
Interfaz Grafica

1. Cargar XML

2. XML Cargado

3. Guardar XML
4. Se carga el XML generado.

5. XML cargado con sus modificaciones.

En este caso se modifico el último punto.

6. Guardar archivo Texto.


7. Texto generado por la aplicación.

8. Documentos Creados.
Parte dos.

Xml de configuración de instalación de Mysql Server 8.0

Por lo entendido de la materia y lo que puedo describir de este XML es que nos permite
configurar algunas partes de la instalación de Mysql, en este caso puedo indicar en una de las
líneas de el archivo Installer_config.xml, podemos modificar el port de conexión, también
puedo deducir en la línea ConfigureAsService, esta nos permite modificar en verdadero o falso
el servicio.

Nota: espero estar en lo correcto o por lo menos acercarme a lo solicitado.


Bibliografía

IACC (2016). Clases de entrada/salida en .NET Framework y manejo de memoria. Programación

.NET – II. Semana 8.

You might also like