merci pour l'aide, j'ai trouvé l'erreur ^^
voila le code corrigé :
Module Module1 Public class1 As New Form1 Public class2 As New Form2 Public a As String Public b As Long
Sub main() class1.Text = "Formulaire1" class2.Text = "Formulaire2" Application.Run(class1)
End Sub End Module
-------------------
Public Class Form1
Private Sub quitter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitter.Click Dim msg = MsgBox("quitter maintenant ?", MsgBoxStyle.YesNoCancel, "quitter") If msg = MsgBoxResult.Yes Then Application.Exit() End If End Sub
Private Sub toform2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles toform2.Click a = class1.texte1.Text class1.Hide() class2.Show() End Sub End Class
---------------------
Public Class Form2
Private Sub quitter2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitter2.Click Dim msg = MsgBox("quitter maintenant ?", MsgBoxStyle.YesNoCancel, "quitter") If msg = MsgBoxResult.Yes Then Application.Exit() End If End Sub
Private Sub texte2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles texte2.TextChanged class2.texte2.Text = a End Sub
Private Sub nombre2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nombre2.TextChanged class2.nombre2.Text = b End Sub
Private Sub toform1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles toform1.Click class2.Hide() class1.Show() End Sub
Private Sub inserer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inserer.Click class2.texte2.Text = a class2.nombre2.Text = b End Sub End Class
pour ne pas faire un autre sujet : on clique où sur le form pour avoir form1_closing ou form1_activated ? j'ai cherché partout mais pas de solution, j'ai toute un tp à faire lié à ça
merci
|