Stephen Holt
Member
I know this question will seem stupid for all of you whom are familiar with the coding here. I used do a lot of calculators in VB. I just want to perform calculations on 2 numbers placed into edittext boxes named Voltage and Amperage then place the result in a edittext box named Resistance. I also want to trap errors by verifying that a number was placed in the Voltage and Amperage textboxs prior to running the calculations.
Any help would be sincerely appreciated.
Current Code gets errors on both the error traps and Resistance = Voltage / Amperage
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Dim Amperage As Double
Dim Resistance As Double
Dim Voltage As Double
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("first")
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("first")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'If Voltage_TextChanged = "" Then
'Msgbox("You must enter a voltage first","oops")
'End If
'If Amperage_TextChanged = "" Then
'Msgbox("You must enter an amperage first","oops")
'End If
Resistance = Voltage / Amperage
End Sub
Sub Voltage_TextChanged (Old As String, New As String)
End Sub
Sub Resistance_TextChanged (Old As String, New As String)
End Sub
Sub Amperage_TextChanged (Old As String, New As String)
End Sub
Any help would be sincerely appreciated.
Current Code gets errors on both the error traps and Resistance = Voltage / Amperage
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Dim Amperage As Double
Dim Resistance As Double
Dim Voltage As Double
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("first")
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("first")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'If Voltage_TextChanged = "" Then
'Msgbox("You must enter a voltage first","oops")
'End If
'If Amperage_TextChanged = "" Then
'Msgbox("You must enter an amperage first","oops")
'End If
Resistance = Voltage / Amperage
End Sub
Sub Voltage_TextChanged (Old As String, New As String)
End Sub
Sub Resistance_TextChanged (Old As String, New As String)
End Sub
Sub Amperage_TextChanged (Old As String, New As String)
End Sub