FECHAS - RECUPERAR 1ER Y ÚLTIMO DIA DE LA SEMANA / MES (Ej. MonthCalendar)

'1er día de la semana 
MonthCalendar.SelectionStart.Date.AddDays(1 - (MonthCalendar.SelectionStart.Date.DayOfWeek))
'Último día de la semana
MonthCalendar.SelectionStart.Date.AddDays(7 - (MonthCalendar.SelectionStart.Date.DayOfWeek))


'1er día del mes
Format(MonthCalendar.SelectionStart.Date.AddDays,"01/MM/yyyy")
'Último día del mes
MonthCalendar.SelectionStart.AddDays(Date.Today.DaysInMonth(Date.Today.Year, Date.Today.Month) - Date.Today.Day)

CREAR DIRECTORIO Y FICHERO EN DIRECTORIO DE LA APLICACIÓN ( Ej. log de Errores)

If Not Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS") Then
      Directory.CreateDirectory(System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS")
End If


Dim ficERR As String = System.AppDomain.CurrentDomain.BaseDirectory & "\LOGS\error" & errTipo & Format(Now, "yyyyMMdd") & ".log"
        
Dim sw As New System.IO.StreamWriter(ficERR, True)
       
sw.WriteLine(Format(Now, "hh:mm:ss") & "|" & errTipo & "|" & errTexto & vbCrLf)
sw.Close()
sw.Dispose()
sw = Nothing
      

EJECUTAR APLICACIÓN PASANDO PARÁMETROS AL EXE

Private Sub Inicio_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
        If Len(Command) Then
            If Trim(UCase(Command)) = "/F1" Then
                Function1()
            Else
                If Trim(UCase(Command)) = "/F2" Then
                    Function2()
                Else
                    If Trim(UCase(Command)) = "/F3" Then
                        Function3()
                    End If
                End If
            End If
        End If
  End Sub


* En acceso directo al ejecutable especificar el parametro en destino. Ej:"C:\MiPrograma\MiPRograma.exe" /F2