Public Class Form7
    Public tam As Integer = 1

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        t6.Text = Form6.TextBox6.Text
        TextBox1.Text = Form6.TextBox6.Text
        TextBox1.Focus()
    End Sub

    Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            TextBox2.Text = TextBox1.Text - t6.Text
            Button3.Focus()
        End If

    End Sub

    Private Sub TextBox2_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
       
    End Sub

    Private Sub Form7_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        tam = 1
    End Sub

    Private Sub t6_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles t6.KeyPress
        If (Not Char.IsControl(e.KeyChar) And Not Char.IsDigit(e.KeyChar) And (e.KeyChar <> ".")) Then
            t6.BackColor = Color.Red
            e.Handled = True
        Else
            t6.BackColor = Color.White
        End If

        If ((e.KeyChar = ".") And ((sender).Text.IndexOf(".") > -1)) Then

            e.Handled = True
        End If
    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If (Not Char.IsControl(e.KeyChar) And Not Char.IsDigit(e.KeyChar) And (e.KeyChar <> ".")) Then
            TextBox1.BackColor = Color.Red
            e.Handled = True
        Else
            TextBox1.BackColor = Color.White
        End If

        If ((e.KeyChar = ".") And ((sender).Text.IndexOf(".") > -1)) Then

            e.Handled = True
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox1.Focus()
        Me.Hide()
        tam = 0

    End Sub
End Class