viernes, 31 de agosto de 2018

Renombrar archivo

 Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(ruta del archivo y el nombre, nombre_nuevo)
My.Computer.FileSystem.RenameFile("C:\Test.txt", "SecondTest.txt")
fuente
fuente2

jueves, 30 de agosto de 2018

lunes, 27 de agosto de 2018

Carpeta respaldo

Public Function folderBkp(ByVal ruta As String) As String
        Dim newFolder As String = Now.ToString("yyyy") & "\" & Now.ToString("MM") & "\" & Now.ToString("dd")
        ruta = ruta & "\" & newFolder
        If Not Directory.Exists(ruta) Then
            Directory.CreateDirectory(ruta)
        End If
        Return ruta
    End Function

Public Function folderBkp(ByVal ruta As String) As String
        ruta = ruta & "\" & Now.ToString("yyyy") & "\" & Now.ToString("MM") & "\" & Now.ToString("dd")
        If Not Directory.Exists(ruta) Then
            Directory.CreateDirectory(ruta)
        End If
        Return ruta
    End Function

jueves, 23 de agosto de 2018

Abrir un archivo xml XDocument

Dim doc As XDocument = XDocument.Load("C:\archivo.xml")
Dim xmldoc As New XmlDocument

xmldoc.LoadXml(doc.ToString)

Remover comentarios un xml

Dim xmlregex As String = Regex.Replace(xnode.OuterXml, "<!--.*?-->", String.Empty, RegexOptions.Singleline)

martes, 21 de agosto de 2018

formato fecha

fechaInicial = DateTime.Now.AddMonths(-1).ToString("yyyyMMdd")
fechaFinal = DateTime.Now.ToString("yyyyMMdd")

xml sql <>

Reemplazar en xml < > por !=

jueves, 9 de agosto de 2018

Recorrer ComboBox

For Each c As Object In ComboBox.Items
   Message.Box(CStr(c))
Next

miércoles, 8 de agosto de 2018

Agregar combobox DataGrid

dgv.Rows.Add()

        Dim rowIndex As Integer = 0
        Dim colIndex As Integer = 0
        For rowIndex = 0 To dgv.Rows.Count - 1
            Dim comboBoxCell As New DataGridViewComboBoxCell
            comboBoxCell.Items.Add("Clear Force")
            comboBoxCell.Items.Add("this works")
            comboBoxCell.Items.Add("well")
            comboBoxCell.Value = "Clear Force"
            dgv(1, rowIndex) = comboBoxCell

        Next

dgv(1, 1).Value = "well"


fuente