sábado, 9 de mayo de 2020

Carpeta de instalacion windows service

 Try
            ' Agregar Referencia System.Management.dll
            Dim RutaService As String = ""
            Using wmiService As ManagementObject = New ManagementObject("Win32_Service.Name='" + NombreServicio + "'")
                wmiService.Get()
                RutaService = System.IO.Directory.GetParent(wmiService("PathName").ToString.Replace("""", "")).ToString
            End Using
            Process.Start(RutaService)
        Catch ex As Exception
            MessageBox.Show("La carpeta no existe", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

fuente

viernes, 8 de mayo de 2020

String to timespan

Dim Seconds As Integer = TimeSpan.Parse("00:00:30").Seconds


fuente


martes, 5 de mayo de 2020

datagridview combobox cambiar el valor de una celda al seleccionar un dato

 Private Sub dgv_variables_CurrentCellDirtyStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgv_var_simple.CurrentCellDirtyStateChanged
        If dgv_var_simple.IsCurrentCellDirty Then
            dgv_var_simple.CommitEdit(DataGridViewDataErrorContexts.Commit)
            dgv_var_simple.EndEdit()
        End If
    End Sub

fuente

query blob

Las variables se declaran con el nombre del campo antecedido por una @

Actualizar combobox

DataGridView.EndEdit()