35 lines
1.5 KiB
VB.net
35 lines
1.5 KiB
VB.net
Namespace My
|
|
|
|
' Für MyApplication sind folgende Ereignisse verfügbar:
|
|
'
|
|
' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst.
|
|
' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung nicht normal beendet wird.
|
|
' UnhandledException: Wird ausgelöst, wenn in der Anwendung ein Ausnahmefehler auftritt.
|
|
' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn diese bereits aktiv ist.
|
|
' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst.
|
|
Partial Friend Class MyApplication
|
|
|
|
Private Sub MyApplication_Startup(sender As Object, e As ApplicationServices.StartupEventArgs) Handles Me.Startup
|
|
Try
|
|
Dim args() As String = Environment.GetCommandLineArgs()
|
|
If args.Length <> 2 Then
|
|
MsgBox("No application parameters!", MsgBoxStyle.Critical)
|
|
'' Exit Sub
|
|
End If
|
|
For Each Str As String In args
|
|
If Str.Contains("Server") Then
|
|
My.Settings.MyConnectionString = Str
|
|
My.Settings.Save()
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
MsgBox("Error in ParseArgs:" & vbNewLine & ex.Message)
|
|
Exit Sub
|
|
End Try
|
|
End Sub
|
|
End Class
|
|
|
|
|
|
End Namespace
|
|
|