![]() |
Tipp 0131
|
Wechselseitiger Formularzugriff
|
 |
|
Autor/Einsender: Datum: |
|
Michael Werner 13.08.2006 |
|
Entwicklungsumgebung: |
|
VB.Net 2003 |
Framework: |
|
1.1 |
|
|
Das Projekt demonstriert, wie zwischen 2 Formularen gewechselt, d.h. hin- und hergeschaltet werden kann (hier Form2 und Form3).
Schließen Sie jeweils Form2 bzw. Form3. Damit wird die jeweils andere Form angezeigt. Außerdem wird gezeigt, wie man
Formulare (Forms) nebeneinander positioniert.
|
|
|
Public Class Form1
Inherits System.Windows.Forms.Form
Vom Windows Form Designer generierter Code
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "Das Projekt demonstriert, wie zwischen " & _
"2 Formen gewechselt werden kann " & _
"(hier Form2 und Form3). Schließen Sie " & _
"jeweils Form2 bzw. Form3."
Start.F2.Show()
Start.F2.Left = Me.Left + Me.Width
Start.F2.Top = Me.Top
End Sub
End Class
Public Class Start
Public Shared F1 As New Form1
Public Shared F2 As New Form2
Public Shared F3 As New Form3
Public Shared Sub Main()
Application.Run(F1)
End Sub
End Class
|
|
|
Und in Form2 und Form3 im jeweiligen Closing-Ereignis:
|
|
|
Start.F3.Show() 'bzw. in Form3_Closing Start.F2.Show
Me.Hide()
e.Cancel = True
|
|
|
|
|
Windows-Version |
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
|
Download (12,2 kB)
|
Downloads bisher: [ 435 ]
|
|
|