1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
'fenetre mdi
Public Class Principal
Public Sub New()
' Cet appel est requis par le concepteur.
InitializeComponent()
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
Me.WindowState = FormWindowState.Maximized
Me.IsMdiContainer = True
Me.MenuItemWindow.MdiList = True
End Sub
Private Sub MenuItemNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemNew.Click
'le child form1
Dim NomDuForm As String = "Civilites"
Dim NomTable As String = "Personnel1"
Dim t As New Form1()
t.Name = NomDuForm
t.Text = NomTable
t.MdiParent = Me
t.Show()
t.Focus()
' PAR ICI L'AJOUT :le child form2
NomDuForm = "Reglementation"
NomTable = "Personnel3"
Dim t2 = New Form2()
t2.Name = NomDuForm
t2.Text = NomTable
t2.MdiParent = Me
t2.Show()
t2.Focus()
End Sub
Private Sub MenuItemClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemClose.Click
Me.ActiveMdiChild.Close()
End Sub
Private Sub BindingSource1_ListChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ListChangedEventArgs) Handles BindingSource1.ListChanged
Me.ToolStripStatusLabel1.Text = e.ListChangedType.ToString()
End Sub
Private Sub MenuItemHorizontal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemHorizontal.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
End Class
'fenetre child 1 sans changement
Public Class Form1
Public Sub New()
' Cet appel est requis par le concepteur.
InitializeComponent()
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Personnel1TableAdapter1.Fill(Me.PersonnelDataSet1.Tables(Me.Text))
Principal.BindingSource1.RaiseListChangedEvents = True
Principal.BindingSource1.DataSource = Me.PersonnelDataSet1
Principal.BindingSource1.DataMember = Me.Text
Me.DataGridView1.DataSource = Principal.BindingSource1
End Sub
End Class
'fenetre child 2
'dropper :
' le composant datset PersonnelDataSet1
' le composant Personnel3TableAdapter1
Public Class Form2
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'PAR LA DIFF:Personnel3TableAdapter1(note personnel3)
Me.Personnel3TableAdapter1.Fill(Me.PersonnelDataSet1.Tables(Me.Text))
Principal.BindingSource1.RaiseListChangedEvents = True
Principal.BindingSource1.DataSource = Me.PersonnelDataSet1
Principal.BindingSource1.DataMember = Me.Text
Me.DataGridView1.DataSource = Principal.BindingSource1
End Sub
End Class |
Partager