-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquadratic.vb
47 lines (43 loc) · 1.33 KB
/
quadratic.vb
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
Public Class quadratic
'fade in...
Public Sub fade_In()
For fadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = fadeIn
'Me.Refresh()
Threading.Thread.Sleep(100)
Next
End Sub
'... fade out...
Public Sub fade_out()
For FadeOut = 90 To 10 Step -10
Me.Opacity = FadeOut / 100
'Me.Refresh()
Threading.Thread.Sleep(100)
Next
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a, b, c As Double
Dim D, x1, x2 As Double
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)
D = (b ^ 2) - (4 * a * c)
If D >= 0 Then
x1 = (-b + Math.Sqrt(D)) / (2 * a)
x2 = (-b - Math.Sqrt(D)) / (2 * a)
MsgBox("x1 is " & x1 & " and " & "x2 is " & x2)
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox1.Focus()
Else
MsgBox("complex roots")
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox1.Focus()
End If
End Sub
Private Sub quadratic_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class