Hey guys, I'm trying to make a program that uses Ohms circle to calculate varying data regarding electricity, I think that if you look at my code you'll get a good idea. The PROBLEM that I'm having is that I'm using On Error Resume Next so the program will automatically find the valid calculation to calculate the value for the variable, but what's happening is that when it divides by zero (the default value for variables with no value) it gets Infinity, which it has decided IS a value, but I don't want it to be, I need a runtime error so it will bypass that calculation and go on to the next one.

Code:
       'Skip erroneous statements and continue on to next line of valid code
        On Error Resume Next
        '--------------------------
        'VARIABLES
        '--------------------------
        'v = voltage
        Dim v As Double = Double.Parse(txtVolt.Text)
        'i = amperage
        Dim i As Double = Double.Parse(txtAmp.Text)
        'r = resistance
        Dim r As Double = Double.Parse(txtOhm.Text)
        'p = wattage
        Dim p As Double = Double.Parse(txtWatt.Text)
        '--------------------------
        'CALCULATIONS
        '--------------------------
        'If nothing in amperage
        If txtAmp.Text = "" Then
            i = p / v
            i = v / r
            i = System.Math.Sqrt(p / r)
        End If

        'If nothing in voltage
        If txtVolt.Text = "" Then
            v = p / i
            v = System.Math.Sqrt(p * r)
            v = i * r
        End If

        'If nothing in ohms
        If txtOhm.Text = "" Then
            r = v / i
            r = p / (i ^ 2)
            r = (v ^ 2) / p
        End If

        'If nothing in watts
        If txtWatt.Text = "" Then
            p = v * i
            p = (v ^ 2) / r
            p = (i ^ 2) * r
        End If
        '--------------------------
        'OUTPUT
        '--------------------------
        txtVolt.Text = v.ToString
        txtAmp.Text = i.ToString
        txtOhm.Text = r.ToString
        txtWatt.Text = p.ToString
Big thanks to anyone who can help, I've been working on this for a few weeks with no good results.