miércoles, 27 de diciembre de 2017

update left join

Update t 
SET 
       t.Column1=100
FROM 
       myTableA t 
LEFT JOIN 
       myTableB t2 
ON 
       t2.ID=t.ID
fuente: https://stackoverflow.com/questions/6335388/update-and-left-outer-join-statements

martes, 26 de diciembre de 2017

Validar números TextBox

If String.IsNullOrEmpty(tbnumber.Text.Trim("0")) Then
            tbnumber.Clear()
            MessageBox.Show("Ingrese un valor mayor que cero")

            Exit Sub
        Else
            Dim number As Long = 0
            Dim result As Boolean = Int64.TryParse(tbnumber.Text.Trim, number)

            If Not result Then
                MessageBox.Show("Número no válido")
            Else
                tbnumber.Text = tbnumber.Text.TrimStart("0")
            End If

            MessageBox.Show(result)
        End If

Deshabilitar copiar-pegar en un TextBox

Propiedades
ShortcutsEnabled = False

martes, 19 de diciembre de 2017

viernes, 15 de diciembre de 2017

Servicio modo debug

Service1.Designer.vb

#If DEBUG Then
        Dim x As New Service1
        x.Ondebug()
#Else
#End If




' The main entry point for the process
    <MTAThread()> _
    <System.Diagnostics.DebuggerNonUserCode()> _
    Shared Sub Main()

#If DEBUG Then
        Dim debug_service As New Service1
        debug_service.Ondebug()
#Else


        Dim ServicesToRun() As System.ServiceProcess.ServiceBase

        ' More than one NT Service may run within the same process. To add
        ' another service to this process, change the following line to
        ' create a second service object. For example,
        '
        '   ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
        '
        ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service1}

        System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
    End Sub

miércoles, 13 de diciembre de 2017

Crear directorio

Try
            Directory.CreateDirectory("nombreDirectorio")
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        End Try