Public Class mainForm
    'Copyright Stijn Coenen 1ELO/ELO1
    'Opdracht visual basic 2007
    '
    'Afmetingen form met uitkomst 666; 618
    'Afmetingen form Zonder uitkomst 368; 618
    '****************************************************************************************************
    'On form load
    Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles MyBase.Load
        Me.Width = (368)
        LedvoorschakelR.Visible = False
        VoorschakelC.Visible = False
        PicSchemaR.Visible = False
        lblGeenschema.Visible = False
        LedvoorschakelR.Visible = False
        VoorschakelC.Location = New Point(366, 27)
        Me.MaximizeBox = False
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'MenuStrip
    Private Sub SluitenToolStripMenuItem_Click(ByVal sender As System.Object, _
        ByVal e As _
    System.EventArgs) Handles mnuBestandSluiten.Click
        Me.Close()
    End Sub
    Private Sub OverToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As _
            System.EventArgs) Handles mnuHelpInfo.Click

    End Sub
    Private Sub ControlerenOpUpdatesToolStripMenuItem_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) Handles mnuHelpUpdates.Click
        Updates.Show()
    End Sub
    Private Sub InfoOverDitProgrammaToolStripMenuItem_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) Handles InfoOverDitProgrammaToolStripMenuItem.Click
        over.Show()
    End Sub
    Private Sub EreeksenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e _
        As System.EventArgs) Handles EreeksenToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://nl.wikipedia.org/wiki/E-reeksen")
    End Sub
    Private Sub KleurcodeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KleurcodeToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://nl.wikipedia.org/wiki/Elektronische_kleurcode")
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Led voorschakelweerstand
    Public Sub bntBereken_Click(ByVal sender As System.Object, ByVal e As _
        System.EventArgs) Handles bntBereken.Click

        '************************************************************************************************
        ' Declaren

        'Input declaraties
        Dim vSpanning As Single = 0
        Dim lSpanning As Single = 0
        Dim lstroom As Single = 0
        Dim aantalLeds As Byte = 0
        Dim aantal As Byte = 0
        'Bereken declaraties
        Dim weerstand As Single = 0
        Dim vermogen As Single = 0
        Dim eWeerstand As Single = 0
        Dim eStroom As Single = 0
        Dim eVermogen As Single = 0
        Dim pBestVermogen As Single = 0
        'Variabelen voor kleurcode
        Dim Ring1 As Byte = 0
        Dim Ring2 As Byte = 0
        Dim Ring3 As Byte = 0
        'Variabelen voor E weerstanden uit te zoeken
        Dim exponent As Single = 0
        Dim Rwaarde As Single = 0
        Dim waarde As Single = 0
        Dim tussenuitkomst As Single = 0
        Dim teller As Byte = 0
        lblWeerstandFout.Visible = False

        '************************************************************************************************
        'Inlezen tekstvakken
        vSpanning = CType(txtSpanning.Text, Single)
        lSpanning = CType(txtLedSpanning.Text, Single)
        lstroom = CType(txtLedStroom.Text, Single)
        aantalLeds = CType(txtAantal.Text, Single)

        '************************************************************************************************
        'Textboxen nakijken op foute invoer

        'Kijken of Voedingsspanning groot genoeg is
        If vSpanning < (lSpanning * aantalLeds) Then
            MessageBox.Show("Te kleine voedingsspanning", "Fout", _
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            GoTo einde
        End If

        'Kijken of het aantal leds groter of gelijk dan 1 is.
        If aantalLeds < 1 Then
            MessageBox.Show("Aantal leds kan niet minder dan 1 zijn", "Fout", _
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            GoTo einde
        End If

        '************************************************************************************************
        'Berekeningen van exacte weerstand en vermogen

        'Exacte weerstand
        '= ( Voedings spanning - ( Led spanning * aantalLeds )) / ( Ledstroom / 1000 )
        weerstand = (vSpanning - (lSpanning * aantalLeds)) / (lstroom / 1000)

        'Exact vermogen gedesippeerd door de weerstand
        '= ( Voedings spanning - ( Led spanning * aantalLeds )) * ( Ledstroom / 1000 )
        vermogen = (vSpanning - (lSpanning * aantalLeds)) * (lstroom / 1000)

        '************************************************************************************************
        'E weerstand berekenen

        'Voor bassiswerkwijze zie 004072-11.xls (Bron Elektuur)
        exponent = Math.Floor(Math.Log10(weerstand))
        tussenuitkomst = weerstand / (Math.Pow(10, exponent))
        waarde = (tussenuitkomst * 100)

        If rdbE12.Checked = True Then

            Rwaarde = eWeerstandE12(waarde)
            'Vierde ring van de weerstand goud kleuren (= tolerantie)
            lblRing4.BackColor = Color.Gold
            lblEWeerst.Text = "E12"

        Else

            Rwaarde = eWeerstandE24(waarde)
            'Vierde ring van de weerstand rood kleuren (= tolerantie)
            lblRing4.BackColor = Color.Red
            lblEWeerst.Text = "E24"

        End If

        '************************************************************************************************
        'Berekeningen met E weerstand

        'E afgeronde weerstand 
        '= Rwaarde * 10 ^ exponent
        eWeerstand = (Rwaarde * (Math.Pow(10, exponent))) / 10

        'Stroom bij E waarden berekenen
        '= (Bronspanning - ( Led spanning / Aantal Leds )) / E afgeronde weerstand
        eStroom = (vSpanning - (lSpanning * aantalLeds)) / eWeerstand

        'Gedissipeerd vermogen bij E weerstand berkenen
        '= (Bronspanning - ( Led spanning / Aantal Leds )) * Stroom bij E afgeronde weerstand
        eVermogen = (vSpanning - (lSpanning * aantalLeds)) * eStroom

        '************************************************************************************************
        'Bestaande waarde vermogenweerstand uitzoeken

        pBestVermogen = WaardeVermogenWeerstand(eVermogen)

        '************************************************************************************************
        'Kleurcode

        'Getallen voor ringen splitsen
        Ring1 = Math.Floor(Rwaarde / 10) ' 560 => 5
        Ring2 = Rwaarde - (Ring1 * 10)
        Ring3 = exponent + 2

        lblRing1.BackColor = kleurcodeRingEen(Ring1)
        lblRing2.BackColor = kleurcodeRingTwee(Ring2)
        If Ring3 > 10 Then
            lblWeerstandFout.Text = _
                "fout" & vbNewLine & _
                "Een weerstand van " & eWeerstand & " Ohm Bestaat niet!" & vbNewLine & _
                "TIP: Probeer meerdere weerstanden in serie of " & vbNewLine & _
                "parallel te zetten."
            lblWeerstandFout.Visible = True
        Else
            lblRing3.BackColor = kleurcodeRingDrie(Ring3)
        End If

        '************************************************************************************************
        'textboxen invullen
        txtExacteweerstand.Text = (Math.Round(weerstand, 3)).ToString
        txtVermogen.Text = (Math.Round(vermogen, 3)).ToString

        txtEafgerondeweerstand.Text = (Math.Round(eWeerstand, 3)).ToString
        txtEStroom.Text = (Math.Round(eStroom, 3)).ToString
        txtEVermogen.Text = (Math.Round(eVermogen, 3)).ToString
        txtBestVermogen.Text = pBestVermogen.ToString

        '************************************************************************************************
        'Schema's
        'Schema zichtbaar maken
        PicSchemaR.Visible = True
        lblGeenschema.Visible = False

        'Schema kiezen
        Select Case aantalLeds
            Case 1
                PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources._1LED
            Case 2
                PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources._2LED
            Case 3
                PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources._3LED
            Case 4
                PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources._4LED
            Case 5
                PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources._5LED
            Case Else
                lblGeenschema.Text = "Geen schema mogelijk bij meer dan 5 leds."
                PicSchemaR.Visible = False
                lblGeenschema.Visible = True
        End Select

        '************************************************************************************************
        'Form Eigenschappen
        'Kader voor led voorschakelweerstanden zichtbaar maken + andere onzichtbaar
        VoorschakelC.Visible = False
        LedvoorschakelR.Visible = True

        'Formulier breedte instellen
        Me.Width = (666)
        '************************************************************************************************
einde:
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Voorschakel condensator berekenen
    Private Sub bntCBereken_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntCBereken.Click
        '************************************************************************************************
        'declareren variabelen
        Dim vSpanning As Single = 0
        Dim frequentie As Single = 0
        Dim gSpanning As Single = 0
        Dim gStroom As Single = 0
        Dim vrSpanning As Single = 0

        'Declareren berekende variabele
        Dim RWeerstand As Single = 0
        Dim RVermogen As Single = 0
        Dim VCap As Single = 0
        Dim vcapbst As UShort = 0
        Dim RCap As Single = 0
        Dim cWaarde As Double = 0
        Dim werkVoltage As Short = 0

        '   Bestaande weerstands waarde zoeken
        Dim exponent As Single = 0
        Dim tussenuitkomst As Single = 0
        Dim waarde As Single = 0
        Dim RWeerst As Single = 0

        '   Bestaande condensator waarde Zoeken
        Dim cexponent As Single = 0
        Dim cgrondwaarde As Single = 0
        Dim CbestWaarde As Single = 0

        'Array voor condensatoren
        Dim condensatorarray(17) As Integer
        condensatorarray(0) = 0.8
        condensatorarray(1) = 1
        condensatorarray(2) = 1.5
        condensatorarray(3) = 2
        condensatorarray(4) = 2.2
        condensatorarray(5) = 2.5
        condensatorarray(6) = 3
        condensatorarray(7) = 3.3
        condensatorarray(8) = 3.5
        condensatorarray(9) = 4
        condensatorarray(10) = 4.5
        condensatorarray(11) = 4.7
        condensatorarray(12) = 5
        condensatorarray(13) = 6
        condensatorarray(14) = 6.8
        condensatorarray(15) = 7
        condensatorarray(16) = 8
        condensatorarray(17) = 10

        '<option value="10 µF">10 µF</option>
        

        '************************************************************************************************
        'Inlezen textvakken
        vSpanning = CType(txtCVSpannng.Text, Single)
        frequentie = CType(txtCFrequentie.Text, Single)
        gSpanning = CType(txtCGSpanning.Text, Single)
        gStroom = CType(txtCGStroom.Text, Single)
        vrSpanning = CType(txtCRSpanning.Text, Single)

        '************************************************************************************************
        'Berekenen

        '   ************************************************************************************************
        '   surgeweerstand
        RWeerstand = vrSpanning / gStroom

        '   Surgeweerstand afronden naar E12
        exponent = Math.Floor(Math.Log10(RWeerstand))

        tussenuitkomst = RWeerstand / (Math.Pow(10, exponent))

        waarde = (tussenuitkomst * 100)

        RWeerst = eWeerstandE12(waarde)
        'Vierde ring van de weerstand goud kleuren (= tolerantie)
        lblRing4.BackColor = Color.Gold

        '   Surge weerstand afgeronde weerstand 
        '   = weerstandswaarde * 10 ^ exponent
        RWeerstand = (RWeerst * (Math.Pow(10, exponent))) / 10

        '   Gedissipeerd vermogeen surgeweerstand
        RVermogen = vrSpanning * gStroom

        '************************************************************************************************
        '   Spanning over condensator
        VCap = Math.Sqrt((vSpanning * vSpanning) - ((gSpanning + vrSpanning) * (gSpanning + vrSpanning)))

        '   Condensator impedantie
        RCap = VCap / gStroom

        '   Condensator waarde
        cWaarde = (1 / (2 * Math.PI * frequentie * RCap)) * 1000000

        '   Bestaande condensator waarde zoeken
        cexponent = Math.Floor(Math.Log10(cWaarde))

        cgrondwaarde = cWaarde / (Math.Pow(10, cexponent))

        Select Case cgrondwaarde
            Case 0 To 0.8
                CbestWaarde = condensatorarray(0) ' 0.8
            Case 0.8 To 1
                CbestWaarde = condensatorarray(1) ' 1
            Case 1 To 1.5
                CbestWaarde = condensatorarray(2) ' 1.5
            Case 1.5 To 2
                CbestWaarde = condensatorarray(3) ' 2
            Case 2 To 2.2
                CbestWaarde = condensatorarray(4) ' 2.2
            Case 2.2 To 2.5
                CbestWaarde = condensatorarray(5) ' 2.5
            Case 2.5 To 3
                CbestWaarde = condensatorarray(6) ' 3
            Case 3 To 3.3
                CbestWaarde = condensatorarray(7) ' 3.3
            Case 3.3 To 3.5
                CbestWaarde = condensatorarray(8) ' 3.5
            Case 3.5 To 4
                CbestWaarde = condensatorarray(9) ' 4
            Case 4 To 4.5
                CbestWaarde = condensatorarray(10) ' 4.5
            Case 4.5 To 4.7
                CbestWaarde = condensatorarray(11) ' 4.7
            Case 4.7 To 5
                CbestWaarde = condensatorarray(12) ' 5
            Case 5 To 6
                CbestWaarde = condensatorarray(13) ' 6
            Case 6 To 6.8
                CbestWaarde = condensatorarray(14) ' 6.8
            Case 6.8 To 7
                CbestWaarde = condensatorarray(15) ' 7
            Case 7 To 8
                CbestWaarde = condensatorarray(16) ' 8
            Case 8 To 10
                CbestWaarde = condensatorarray(17) ' 10
        End Select

        CbestWaarde = CbestWaarde * (Math.Pow(10, cexponent))

        '   Gedissipeerd vermogeen surgeweerstand
        RVermogen = vrSpanning * gStroom

        '   Minimale spanningswaarde Condensator Berekenen
        werkVoltage = Math.Sqrt(2) * vSpanning

        '   Bestaande werkspanning condensator zoeken
        Select Case werkVoltage
            Case 0 To 2         '2.5V
                vcapbst = 2.5
            Case 2 To 10        '16V
                vcapbst = 16
            Case 16 To 40       '50V
                vcapbst = 50
            Case 40 To 53       '63V
                vcapbst = 63
            Case 53 To 90       '100V
                vcapbst = 100
            Case 90 To 225      '250V
                vcapbst = 250
            Case 225 To 350     '400V
                vcapbst = 400
            Case 350 To 550     '600V
                vcapbst = 600
            Case 550 To 750     '800V
                vcapbst = 800
            Case 750 To 950     '1000V
                vcapbst = 1000
            Case 950 To 1150    '1200V
                vcapbst = 1200
            Case 1150 To 1500   '1600
                vcapbst = 1600
            Case 1500 To 2400   '2500
                vcapbst = 2500
            Case 2400 To 3900   '4000
                vcapbst = 4000
            Case 3900 To 6000   '6000
                vcapbst = 6000
            Case Else
                vcapbst = 30000
        End Select

        '************************************************************************************************
        'Uitkomsten in tekstvakken zetten:
        txtCSerieR.Text = RWeerstand.ToString
        txtCVermogenR.Text = RVermogen.ToString
        txtCSpanning.Text = VCap.ToString
        txtCImpedantie.Text = RCap.ToString
        txtCWaarde.Text = cWaarde.ToString
        txtCWerkspanning.Text = werkVoltage.ToString
        txtCBEstWerkU.Text = vcapbst.ToString
        txtBestCap.Text = CbestWaarde.ToString

        'formbreedte instellen
        Me.Width = (666)
        'Kader voor voorschakelcondensator zichtbaar maken + andere onzichtbaar
        LedvoorschakelR.Visible = False
        VoorschakelC.Visible = True
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Voorschakel Weerstand bereken
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles Button1.Click
        '************************************************************************************************
        ' Declaren
        'Input declaraties
        Dim vSpanning As Single = 0
        Dim Spanning As Single = 0
        Dim stroom As Single = 0
        Dim reeks As String = "E12"
        'Bereken declaraties
        Dim weerstand As Single = 0
        Dim vermogen As Single = 0
        Dim eWeerstand As Single = 0
        Dim eStroom As Single = 0
        Dim eVermogen As Single = 0
        Dim Rwaarde As Single = 0
        Dim exponent As Single = 0
        Dim waarde As Single = 0
        Dim pBestVermogen As Single = 0
        Dim Ring1 As Byte = 0
        Dim Ring2 As Byte = 0
        Dim Ring3 As Byte = 0

        '************************************************************************************************
        'Inlezen tekstvakken
        vSpanning = CType(txtRVSpanning.Text, Short)
        Spanning = CType(txtRBSpanning.Text, Short)
        stroom = CType(txtRBStroom.Text, Short)
        '************************************************************************************************
        'Berekenen
        weerstand = (vSpanning - Spanning) / (stroom / 1000)
        vermogen = (vSpanning - Spanning) * (stroom / 1000)
        If rdbRE12.Checked = True Then
            reeks = "E12"
        ElseIf rdbRE24.Checked = True Then
            reeks = "E24"
        End If
        'E weerstand uit array halen
        exponent = Math.Floor(Math.Log10(weerstand))
        waarde = ((weerstand / (Math.Pow(10, exponent))) * 100)

        '*******************************************************************************************
        'Naar boven of onder afronden
        If rdbRBoven.Checked = True Then
            If rdbRE12.Checked = True Then
                Rwaarde = eWeerstandE12(waarde)
                lblRing4.BackColor = Color.Gold
            Else
                Rwaarde = eWeerstandE24(waarde)
                lblRing4.BackColor = Color.Red
            End If
            'Naar onder afronden E weerstand
        Else
            If rdbRE12.Checked = True Then
                Rwaarde = eWeerstandOE12(waarde)
                lblRing4.BackColor = Color.Gold
            Else
                Rwaarde = eWeerstandOE24(waarde)
                lblRing4.BackColor = Color.Red
            End If
        End If
        '************************************************************************************************
        'Berekeningen met E weerstand

        'E afgeronde weerstand 
        '= Rwaarde * 10 ^ exponent
        eWeerstand = (Rwaarde * (Math.Pow(10, exponent))) / 10
        'Stroom bij E waarden berekenen
        eStroom = (vSpanning - Spanning) / eWeerstand
        'Gedissipeerd vermogen bij E weerstand berkeen
        eVermogen = (vSpanning - Spanning) * eStroom
        '************************************************************************************************
        'Bestaande waarde vermogenweerstand uitzoeken

        pBestVermogen = WaardeVermogenWeerstand(eVermogen)

        '************************************************************************************************
        'Kleurcode

        'Getallen voor ringen splitsen
        Ring1 = Math.Floor(Rwaarde / 10) ' 560 => 5
        Ring2 = Rwaarde - (Ring1 * 10)
        Ring3 = exponent + 2

        lblRing1.BackColor = kleurcodeRingEen(Ring1)
        lblRing2.BackColor = kleurcodeRingTwee(Ring2)
        If Ring3 > 10 Then
            lblWeerstandFout.Text = _
                "fout" & vbNewLine & _
                "Een weerstand van " & eWeerstand & " Ohm Bestaat niet!" & vbNewLine & _
                "TIP: Probeer meerdere weerstanden in serie of " & vbNewLine & _
                "parallel te zetten."
            lblWeerstandFout.Visible = True
        Else
            lblRing3.BackColor = kleurcodeRingDrie(Ring3)
        End If


        'textboxen invullen
        txtExacteweerstand.Text = weerstand.ToString
        txtVermogen.Text = vermogen.ToString
        txtEafgerondeweerstand.Text = eWeerstand.ToString
        txtEStroom.Text = eStroom.ToString
        txtEVermogen.Text = eVermogen.ToString
        txtBestVermogen.Text = pBestVermogen.ToString
        'Kader voor led voorschakelweerstanden zichtbaar maken + andere onzichtbaar
        VoorschakelC.Visible = False
        LedvoorschakelR.Visible = True
        PicSchemaR.Image = Voorschakelweerstand.My.Resources.Resources.Rdrop
        'Formulier breedte instellen
        Me.Width = (666)

    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Ok knop
    Private Sub bntKleiner_Click(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) _
    Handles bntKleiner.Click
        Me.Width = (368)
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Tekst in tekstvakken selecteren bij klik
    'led voorschakelweerstand
    Private Sub txtAantal_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtAantal.Click
        txtAantal.SelectAll()
    End Sub
    Private Sub txtLedSpanning_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtLedSpanning.Click
        txtLedSpanning.SelectAll()
    End Sub
    Private Sub txtLedStroom_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtLedStroom.Click
        txtLedStroom.SelectAll()
    End Sub
    Private Sub txtSpanning_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtSpanning.Click
        txtSpanning.SelectAll()
    End Sub
    'Voorschakelcondensator
    Private Sub txtCVSpannng_Click(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles txtCVSpannng.Click
        txtCVSpannng.SelectAll()
    End Sub
    Private Sub txtCFrequentie_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCFrequentie.Click
        txtCFrequentie.SelectAll()
    End Sub
    Private Sub txtCGSpanning_Click(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles txtCGSpanning.Click
        txtCGSpanning.SelectAll()
    End Sub
    Private Sub txtCGStroom_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCGStroom.Click
        txtCGStroom.SelectAll()
    End Sub
    Private Sub txtCRSpanning_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCRSpanning.Click
        txtCRSpanning.SelectAll()
    End Sub
    'Voorschakelweerstand
    Private Sub txtRVSpanning_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRVSpanning.Click
        txtRVSpanning.SelectAll()
    End Sub
    Private Sub txtRBStroom_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRBStroom.Click
        txtRBStroom.SelectAll()
    End Sub
    Private Sub txtRBSpanning_Click(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRBSpanning.Click
        txtRBSpanning.SelectAll()
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Kijken of invoer numuriek is en anders wissen
    'led voorschakelweerstand
    Private Sub txtAantal_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtAantal.TextChanged
        If IsNumeric(txtAantal.Text) = False Then
            txtAantal.Clear()
        End If
    End Sub
    Private Sub txtLedSpanning_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtLedSpanning.TextChanged
        If IsNumeric(txtLedSpanning.Text) = False Then
            txtLedSpanning.Clear()
        End If
    End Sub
    Private Sub txtLedStroom_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtLedStroom.TextChanged
        If IsNumeric(txtLedStroom.Text) = False Then
            txtLedStroom.Clear()
        End If
    End Sub
    Private Sub txtSpanning_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles txtSpanning.TextChanged
        If IsNumeric(txtSpanning.Text) = False Then
            txtSpanning.Clear()
        End If
    End Sub
    'Voorschakelcondensator
    Private Sub txtCVSpannng_TextChanged(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles txtCVSpannng.TextChanged
        If IsNumeric(txtCVSpannng.Text) = False Then
            txtCVSpannng.Clear()
        End If
    End Sub
    Private Sub txtCFrequentie_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCFrequentie.TextChanged
        If IsNumeric(txtCFrequentie.Text) = False Then
            txtCFrequentie.Clear()
        End If
    End Sub
    Private Sub txtCGSpanning_TextChanged(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles txtCGSpanning.TextChanged
        If IsNumeric(txtCGSpanning.Text) = False Then
            txtCGSpanning.Clear()
        End If
    End Sub
    Private Sub txtCGStroom_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCGStroom.TextChanged
        If IsNumeric(txtCGStroom.Text) = False Then
            txtCGStroom.Clear()
        End If
    End Sub
    Private Sub txtCRSpanning_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtCRSpanning.TextChanged
        If IsNumeric(txtCRSpanning.Text) = False Then
            txtCRSpanning.Clear()
        End If
    End Sub
    'Voorschakelweerstand
    Private Sub txtRVSpanning_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRVSpanning.TextChanged
        If IsNumeric(txtRVSpanning.Text) = False Then
            txtRVSpanning.Clear()
        End If
    End Sub
    Private Sub txtRBStroom_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRBStroom.TextChanged
        If IsNumeric(txtRBStroom.Text) = False Then
            txtRBStroom.Clear()
        End If
    End Sub
    Private Sub txtRBSpanning_TextChanged(ByVal sender As Object, ByVal e As _
        System.EventArgs) Handles txtRBSpanning.TextChanged
        If IsNumeric(txtRBSpanning.Text) = False Then
            txtRBSpanning.Clear()
        End If
    End Sub
    '****************************************************************************************************

    '****************************************************************************************************
    'Tijd in titelbalk weergeven
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As _
        System.EventArgs) Handles Timer1.Tick
        Me.Text = "RC-Calc www.ElektronicaStynus.be             " & TimeOfDay
    End Sub
    '****************************************************************************************************

End Class