TextBox2.Text = "46,6" Dim x As Double Dim k As Double If Double.TryParse(TextBox2.Text, x) Then k = Math.Sqrt(x) End If
Try x = Double.Parse(TextBox2.Text) k = Math.Sqrt(x) Catch ex As Exception MessageBox.Show(ex.Message) End Try
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionmais si par exemple on fait la meme chose pr 3 textbox
dont les valeurs sont deja calculé
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox4.Text = Val(TextBox1.Text) TextBox5.Text = Val(TextBox2.Text) TextBox6.Text = Val(TextBox3.Text) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox7.Text = Math.Sqrt((Val(TextBox1.Text) ^ 2) + (Val(TextBox2.Text) ^ 2) + (Val(TextBox3.Text) ^ 2)) TextBox8.Text = Math.Sqrt((Val(TextBox4.Text) ^ 2) + (Val(TextBox5.Text) ^ 2) + (Val(TextBox6.Text) ^ 2)) End Sub End Class