Tipp 0030 Mehrfaches Öffnen von Formularen verhindern
Autor/Einsender:
Datum:
  Bernhard Froschauer
17.02.2004
Entwicklungsumgebung:   VB.Net 2002
Framework:   1.0
Mithilfe von Shared Functions wird verhindert, dass Formulare mehrfach geöffnet werden. Beim Öffnen wird der Formularname in einem Array gespeichert. Beim Schließen wird der Formularname aus dem Array gelöscht. Vor jedem Öffnen eine Formulars wird das Array durchsucht, und sollte der Formularname enthalten sein, wird das Öffnen unterbunden.
 
Public Class global
  Shared Formarray As New ArrayList

  Public Shared Function formularoeffnen( _
        ByVal mform As String) As Boolean
    Formarray.Add(mform)
  End Function

  Public Shared Function formularoffen( _
        ByVal mform As String) As Boolean

    Dim i As Int32 = -1
    Formarray.Sort()
    i = Formarray.IndexOf(mform)
    If Not i = -1 Then
      Return True
    Else
      Return False
    End If
  End Function

  Public Shared Function formschliessen( _
        ByVal mform As String) As Boolean
    Formarray.Remove(mform)
  End Function
End Class
 
Weitere Links zum Thema
Formszugriff mit überladenem Konstruktor
Schließverhalten von Formularen ändern

Windows-Version
98/SE
ME
NT
2000
XP
Vista
Win 7


Download  (6,2 kB) Downloads bisher: [ 840 ]

Vorheriger Tipp Zum Seitenanfang Nächster Tipp

Startseite | Tipps | Projekte | Tutorials | Bücherecke | VB-/VBA-Tipps | API-Referenz | Komponenten | VB.Net-Forum | VB/VBA-Forum | DirectX-Forum | Foren-Archiv | DirectX | Chat | Spielplatz | Links | Suchen | Stichwortverzeichnis | Feedback | Impressum

Seite empfehlen Bug-Report
Letzte Aktualisierung: Sonntag, 22. Januar 2012