Sample

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#Region Project Attributes

#ApplicationLabel: B4A Example


#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes


#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
Private Button1 As Button
Private Button2 As Button
Private Button3 As Button
Private EditText1 As EditText
Private EditText2 As EditText
Private EditText3 As EditText
Private EditText4 As EditText
Private EditText5 As EditText
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)


Activity.LoadLayout("Layout")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
Dim total As Int

If EditText1.Text = "" And EditText2.Text = "" Then


Msgbox("Please Enter Price and Quantity", "Warning")
EditText1.RequestFocus

Else If EditText1.Text = "" Then


Msgbox("Please Enter Price", "Warning")
EditText1.RequestFocus
Else If EditText2.Text = "" Then
Msgbox("Please Enter Quantity", "Warning")
EditText2.RequestFocus
Else
total= EditText1.Text * EditText2.Text
EditText3.Text = total
End If
End Sub

Private Sub Button2_Click


Dim change As Int

If EditText3.Text = "" And EditText4.Text = "" Then


Msgbox("Please Enter Total and Cash", "Warning")

Else If EditText3.Text = "" Then


Msgbox("Please Click Total", "Warning")

Else If EditText4.Text = "" Then


Msgbox("Please Enter Cash", "Warning")
EditText4.RequestFocus

Else if EditText3.Text > EditText4.Text Then


Msgbox("Unsuficient Money","Sorry")

Else
change= EditText4.Text - EditText3.Text
EditText5.Text = change
End If
End Sub

Private Sub Button3_Click


EditText1.Text = ""
EditText2.Text = ""
EditText3.Text = ""
EditText4.Text = ""
EditText5.Text = ""
EditText1.RequestFocus
End Sub

You might also like