VERSION 5.00
Begin VB.Form frmresistance 
   BackColor       =   &H000000FF&
   Caption         =   "DC"
   ClientHeight    =   10485
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   13545
   LinkTopic       =   "Form1"
   ScaleHeight     =   10485
   ScaleWidth      =   13545
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   4560
      Top             =   240
   End
   Begin VB.CommandButton Command1 
      Caption         =   "AC"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   975
      Left            =   960
      TabIndex        =   17
      Top             =   960
      Width           =   1935
   End
   Begin VB.TextBox txtE1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   8880
      TabIndex        =   13
      Top             =   4320
      Width           =   1815
   End
   Begin VB.TextBox txtres3 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   8880
      TabIndex        =   11
      Top             =   3600
      Width           =   1815
   End
   Begin VB.CommandButton exit 
      BackColor       =   &H000000FF&
      Caption         =   "Exit"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   12360
      TabIndex        =   6
      Top             =   3000
      Width           =   2055
   End
   Begin VB.CommandButton cmdclear 
      Caption         =   "Clear"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   12360
      TabIndex        =   5
      Top             =   3720
      Width           =   2055
   End
   Begin VB.CommandButton cmdcalculate 
      BackColor       =   &H000000FF&
      Caption         =   "Calculate"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   12360
      TabIndex        =   4
      Top             =   2400
      Width           =   2055
   End
   Begin VB.TextBox txtres2 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   8880
      TabIndex        =   3
      Top             =   2760
      Width           =   1815
   End
   Begin VB.TextBox txtres1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   8880
      TabIndex        =   2
      Top             =   2040
      Width           =   1815
   End
   Begin VB.Label Label3 
      BackColor       =   &H000000FF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   9000
      TabIndex        =   20
      Top             =   720
      Width           =   855
   End
   Begin VB.Label Label2 
      BackColor       =   &H000000FF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   8640
      TabIndex        =   19
      Top             =   720
      Width           =   1095
   End
   Begin VB.Label Label 
      BackColor       =   &H000000FF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   8280
      TabIndex        =   18
      Top             =   720
      Width           =   855
   End
   Begin VB.Label lblthevr 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   855
      Left            =   7320
      TabIndex        =   16
      Top             =   6000
      Width           =   5535
   End
   Begin VB.Label lblthevv 
      BackColor       =   &H80000000&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   855
      Left            =   7320
      TabIndex        =   15
      Top             =   5040
      Width           =   5535
   End
   Begin VB.Label lblparallel2 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   855
      Left            =   7320
      TabIndex        =   14
      Top             =   7080
      Width           =   5535
   End
   Begin VB.Label lblE1 
      BackStyle       =   0  'Transparent
      Caption         =   "Voltage"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   495
      Left            =   7200
      TabIndex        =   12
      Top             =   4320
      Width           =   2055
   End
   Begin VB.Label lblres3 
      BackStyle       =   0  'Transparent
      Caption         =   "3rd Resistor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   615
      Left            =   7200
      TabIndex        =   10
      Top             =   3720
      Width           =   2415
   End
   Begin VB.Label lblinitials 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   615
      Left            =   5160
      TabIndex        =   9
      Top             =   240
      Width           =   7335
   End
   Begin VB.Label lblparallel 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   855
      Left            =   7320
      TabIndex        =   8
      Top             =   9120
      Width           =   5535
   End
   Begin VB.Label lblseries 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   855
      Left            =   7320
      TabIndex        =   7
      Top             =   8160
      Width           =   5535
   End
   Begin VB.Label lblres2 
      BackStyle       =   0  'Transparent
      Caption         =   "2nd Resistor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   495
      Left            =   7200
      TabIndex        =   1
      Top             =   2880
      Width           =   2415
   End
   Begin VB.Label lblres1 
      BackStyle       =   0  'Transparent
      Caption         =   "1st Resistor"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   375
      Left            =   7200
      TabIndex        =   0
      Top             =   2160
      Width           =   2295
   End
End
Attribute VB_Name = "frmresistance"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Rem Created : 25/12/2007
Rem Project : graded unit
Rem Input :user enters resistance values
Rem Process :program uses already stored program to use formula
Rem output: progam displays progam

Private Sub Command1_Click()

frmresistance.Hide
AC.Show
End Sub


    'i have used parallel as nortons
    'i have used series as thevenins
   

Private Sub cmdcalculate_Click()
Dim res1 As Single, res2 As Single, series As Single, parallel As Single


'Enter Resistor Values
res1 = txtres1.Text
If res1 = 0 Then res1 = 1

res2 = txtres2.Text
If res2 = 0 Then res2 = 1
res3 = txtres3.Text
If res3 = 0 Then res3 = 1
E1 = txtE1.Text     'v1


'series
'       thevenin voltage(vi * r3 / r1 + r3)
'       thevenin resistance r= r2+(r1+r3/r1+r3)
                        
 
' formula used to calculate thevenin
thevenin = (E1 * res3) / (res1 + res3)
theveninR = (res2 + ((res1 * res3) / (res1 + res3)))
thevenin = Round(thevenin, 2)
theveninR = Round(theveninR, 2)

'Display thevenin on the Form
lblthevv.Caption = "thevenin voltage = " + Str(thevenin) + " v"
lblthevr.Caption = "thevenin resistance =" + Str(theveninR) + " ohms"





 'parallel
            'Vab = (V1*R3)/(R1+R3)
            'nortons resistance  R2+(R1R3/R1+R3)
            'Nortons Current = Vab/r
            
            
' formula used to calculate nortans
parallel = ((E1 * res3) / (res1 + res3))
parallel2 = (res2 + ((res1 * res3) / (res1 + res3)))
series = parallel / parallel2


parallel = Round(parallel, 2)
parallel2 = Round(parallel2, 2)
series = Round(series, 2)

'Display Nortons Resistance on the Form
lblparallel.Caption = "open circuit voltage =" + Str(parallel) + " v"
lblparallel2.Caption = "nortons resistance =" + Str(parallel2) + " ohms"
lblseries.Caption = "nortons current = " + Str(series) + " amps"

End Sub
'Click to clear Form Data
Private Sub cmdclear_Click()
txtres1.Text = ""
txtres2.Text = ""
txtres3.Text = ""
txtE1.Text = ""

lblseries.Caption = ""
lblparallel.Caption = ""
lblparallel2.Caption = ""
lblthevv.Caption = ""
lblthevr.Caption = ""

End Sub
'click to end program
Private Sub exit_Click()
'Click to show program end message
dummy = MsgBox("thank you for using azi programming©", , "Good Bye")
'End Program
End
End Sub



Private Sub Timer1_Timer()
Label.Caption = Hour(Time)
Label2.Caption = Minute(Time)
Label3.Caption = Second(Time)

End Sub

Private Sub txttime_Change()
Label.Caption = Hour(Time)
Label2.Caption = Minute(Time)
Label3.Caption = Second(Time)

End Sub
Private Sub txtres1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case Asc("0") To Asc("9"), 8
            ' Do nothing
        Case Else
        dummy = MsgBox("please enter a number ", , "Error")
        
    End Select
End Sub
Private Sub txtres2_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case Asc("0") To Asc("9"), 8
            ' Do nothing
        Case Else
        dummy = MsgBox("please enter a number ", , "Error")
        
    End Select
End Sub
Private Sub txtres3_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case Asc("0") To Asc("9"), 8
            ' Do nothing
        Case Else
        dummy = MsgBox("please enter a number ", , "Error")
        
    End Select
End Sub
Private Sub txte1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case Asc("0") To Asc("9"), 8
            ' Do nothing
        Case Else
        dummy = MsgBox("please enter a number ", , "Error")
        
    End Select
End Sub
