码迷,mamicode.com
首页 > 其他好文 > 详细

学起来很简单!MyFirst_B4A_Program

时间:2014-06-18 13:46:13      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:des   class   blog   code   http   tar   

bubuko.com,布布扣

#Region  Project Attributes 
	#ApplicationLabel: MyFirstProgram
	#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.

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.
	Dim btnAction As Button
	Dim edtResult As EditText
	Dim lblComments As Label
	Dim lblMathSign As Label
	Dim lblNumber1 As Label
	Dim lblNumber2 As Label
	Dim Number1, Number2 As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
	‘Do not forget to load the layout file created with the visual designer. For example:
	‘Activity.LoadLayout("Layout1")
	Activity.LoadLayout("Main")
	New 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub New
	Number1 = Rnd(1, 10)			‘ Generates a random number between 1 and 9
	Number2 = Rnd(1, 10)			‘ Generates a random number between 1 and 9
	lblNumber1.Text = Number1		‘ Displays Number1 in label lblNumber1
	lblNumber2.Text = Number2		‘ Displays Number2 in label lblNumber2
	lblComments.Text = "Enter the result" & CRLF & "and click on OK"
	edtResult.Text = ""			‘ Sets edtResult.Text to empty
End Sub

Sub btnAction_Click
	If btnAction.Text = "O K" Then
		If edtResult.Text="" Then
			Msgbox("No result entered","E R R O R")
		Else
			CheckResult
		End If
	Else
		New
		btnAction.Text = "O K"
	End If
End Sub

Sub CheckResult
	If edtResult.Text = Number1 + Number2 Then
		lblComments.Text = "G O O D  result" & CRLF & "Click on NEW"
		btnAction.Text = "N E W"
	Else
		lblComments.Text = "W R O N G  result" & CRLF & "Enter a new result" & CRLF & "and click OK"
	End If
End Sub

 

学起来很简单!MyFirst_B4A_Program,布布扣,bubuko.com

学起来很简单!MyFirst_B4A_Program

标签:des   class   blog   code   http   tar   

原文地址:http://www.cnblogs.com/moodsky/p/3791839.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!