Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click Dim text1 As String = My.Forms.Form1.Label1.Text 'là Label1.Text = text1 End Sub Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click Dim text1 As String = My.Forms.Form1.Label4.Text 'et là Label2.Text = text1 End Sub
Public Class Form2 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Form1.Show() ' affiche Form1 Me.Hide() ' cache Form2 End Sub End Class
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click arduino.PortName = ComboBox1.Text Try arduino.Open() Label5.Text = "conexion activer" Catch ex As Exception MsgBox("la porte n'est pas ouverte") If arduino.IsOpen = False Then MsgBox("la porte n'est pas ouverte") End If End Try End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Try Timer1.Enabled = True Catch ex As Exception MsgBox("faux") Label5.Text = "pas de conection" End Try End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Try TextBox1.Text = arduino.ReadExisting Dim photoresist As String photoresist = (TextBox1.Lines(0).ToString) Dim temperature As String temperature = (TextBox1.Lines(1).ToString) Label1.Text = temperature Label4.Text = photoresist Catch ex As Exception End Try End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Form2.Show() Me.Hide() End Sub End Class
Public Class Form2 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Form1.Show() Me.Hide() End Sub Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click Dim text1 As String = My.Forms.Form1.Label1.Text Label1.Text = text1 End Sub Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click Dim text1 As String = My.Forms.Form1.Label4.Text Label2.Text = text1 End Sub End Class