You are on page 1of 25

VB for Android

Version 1.03
Code.google.com/p/vb4android

2012-12-11
Aslamic Louis
Email: yourdds520@163.com

Versions:
2012-12-09 V1.0
2012-12-10 V1.01
2012-12-11 V1.02
2012-12-16 V1.03


1......................................................................................................................................... 3
1.1.................................................................................................................................. 3
1.2 .................................................................................................................... 8
1.2.1 ....................................................................................................... 10
1.3 .................................................................................................................. 11
2....................................................................................................................................... 11
3. .................................................................................................................................... 11
3.1 API ....................................................................................................................12
3.2 .......................................................................................................................... 15
3.3 .................................................................................................................................. 16
3.4 .......................................................................................................................... 19
4 ..................................................................................................................................... 20
4.1 .............................................................................................................................. 20
4.2 .............................................................................................................................. 20
4.3 .................................................................................................................................. 20
4.3.1 ............................................................................................................... 20
4.3.2 ............................................................................................................... 21
4.4 .................................................................................................................................. 21
4.5 .............................................................................................................................. 21
4.5.1 ....................................................................................................... 21
4.5.2 ........................................................................................................... 22
4.5.3 VB4A .................................................................................................22

1.
1.1.

B.

D.

C.

A.

E.

K.

F.

J.

I.

H.

G.

A.
(Label)(Textbox)(Button)
(Canvas)(Checkbox)(Radiobutton)(Image)
(PasswordTextbox)
B.

GO

APK

APK 2

APK

APK

APK

SRC

Language

Simple

SimpleProject

JAVA_HOME

JAVA_HOME

JDK

JDK

OCX

OCX

PayPal

1.
Simple
APK GO

2.

C.

D.
320*480 Android 1.5

320*480
E.

A.

MyPhone

GPS

GPS

ORIENT

MyTimer

Acc

MyPhone.Initialize()

MyPhone.Available
BooleanPhone

MyPhone.Call(Phonenum as string)
PhonenumPhonenum
MyPhone.Vibrate(duration as integer)
durationduration
MyPhone.SendSMS(phonenum as String,text as String, warnings as String)
Phonenumtext
warnings

MyPhone.SendMail(address as String,text as String)


addresstext
MyPhone.JumpURL(url as String)
url url http://
http://www.google.com.
MyPhone.SocketSend(ip As String,port As Integer,data As String)
data socket tcp ip:port

B.

Event GPS.Initialize()

Event GPS.Changed(latitude As Double, longitude As Double, altitude As Double)


GPS latitude longitude altitude

GPS.Available
BooleanGPS
GPS.Enabled
BooleanGPS
GPS.Latitude
Double
GPS.Longitude
Double
GPS.Altitude
Double

C.

Event ORIENT.Initialize()

Event ORIENT.OrientationChanged(yaw As Single, pitch As Single, roll As Single)

ORIENT.Available
Boolean
ORIENT.Enabled
Boolean
ORIENT.Yaw
Y Z 0 90 180 270
ORIENT.Pitch
X -180~180
ORIENT.Roll
Y -90~90

ORIENT.Angle

ORIENT.Magnitude

D.

Event MyTimer.Initialize()

Event MyTimer.Timer()

MyTimer.Enabled
Boolean
MyTimer.Interval

E.

Event Acc.Initialize()

Event Acc.AccelerationChanged(xAccel As Single, yAccel As Single, zAccel As


Single)

Event Acc.Shaking()

Acc.Available
Boolean
Acc.Enabled
Boolean
Acc.XAccel
X
Acc.YAccel
Y
Acc.ZAccel
Z

F.

G.

H.

I.

Form

J.

K.
bug bug
VB4A

1.2

1 .

2.

1.2.1
/

J.

Function Test(inval As Single, strin As String)

End Function

1.3

2.
VB4A

1.
2. JAVA_HOME
3. SDK
-
yourdds520@163.com

3.
VB4A VB4A VB6
VB4A VB4A Simple
VB4A Simple Simple

JAVA
VB4A

3.1 API
API Android API VB4A
API API .API
Android

Strings

InStr(str1 As String, str2 As String, start As Integer)

str1 start
str2

InStrRev(str1 As String, str2 As String, start As

Integer)

LCase(ByRef str As String)

UCase(ByRef str As String)

Left(str As String, len As Integer)

str len

Right(str As String, len As Integer)

str len

Mid(str As String, start As Integer, len As Integer)

str start len

Len(str As String)

Trim(ByRef str As String)

LTrim(ByRef str As String)

RTrim(ByRef str As String)

Replace(ByRef str As String, find As String, replace

replace str find

As String, start As Integer, count As Integer

start
count
count -1
0

StrComp(str1 As String, str2 As String)

str2 str1
str1 str2

StrReverse(ByRef str As String)


Format(val As String, format As String)

.##

.00

#.##%

http://blog.163.com/phoenix_ql/b
log/static/5063543820081062381

4776/
Conversions

Math

Asc(str As String)

ASCII

Chr(value As Integer)

ASCII

Hex(v As Variant)

16

Abs(v)

Atn(v)

Atn2(y,x)

(0,0)
X

Cos(v)

Exp(v)

ev

Int(v)

Log(v)

Max(v1,v2)

v1 v2

Min(v1,v2)

v1 v2

Rnd()

Sin(v)

Sgn(v)

10
-1

Sqr(v)

Tan(v)

DegreesToRadians(d)

RadiansToDegrees(r)
Files

Open(Name As String)

Close(Handle As Integer)

Eof(Handle As Integer)

WriteString(Handle As Integer, value As String)

ReadString(Handle As Integer)

WriteLong(Handle As Integer, value As Long)

ReadLong(Handle As Integer)

Rename(oldname As String, newname As String)

oldname
newname

Delete(name As String)

name

Exists(name As String)

name

IsDirectory(name As String)

name

Mkdir(name As String)

name

Rmdir(name As String)

name

Seek(handle As Integer, offset As Long)

Long handle
offset

Application

Size(handle As Integer)

handle

AddMenuItem(Name As String)

Finish()

SwitchForm(FormName As Form)

Form

GetPreference(Name As String)

StorePreference(Name As String, Value as Variant)

ToastMessage(msg As String) *

Toast

Msgbox(title As String, msg As String, btn As String)*

Android

Msgbox

Msgbox

GetTime()
GetDate()
Dates

DateAdd(date As Date, intervalKind As Integer,

date Interval

Interval As Integer)

intervalKind

DateValue(value As String)

String Date
MM/DD/YYYY hh:mm:ss
MM/DD/YYYY.

Day(date As Date)

date

FormatDate(date As Date)

Date String

Hour(date As Date)

date Hour

Minute(date As Date)

date Minute

Month(date As Date)

date Month

Arrays

MonthName(date As Date)

date

Now()

Second(date As Date)

date Second

Timer()

Weekday(date As Date)

date

WeekdayName(date As Date)

date

Year(date As Date)

date Year

Filter(array As String(), str As String, include As


Boolean)
Join(array As String(), separator As String)

separator array

Split(str As String, separator As String, count As

separator

Integer)
UBound(array As Variant,dim As Integer)

dim

1. WriteStringReadStringWriteLong ReadLong

ReadBoolean(Handle As Integer)
WriteBoolean(Handle As Integer, value As Boolean)
ReadByte(Handle As Integer)

WriteByte(Handle As Integer, value As Byte)


ReadDouble(Handle As Integer)
WriteDouble(Handle As Integer, value As Double)
ReadInteger(Handle As Integer)
WriteInteger(Handle As Integer, value As Integer)
ReadShort(Handle As Integer)
WriteShort(Handle As Integer, value As Short)
ReadSingle(Handle As Integer)
WriteSingle(Handle As Integer, value As Single)
VB4A random
* VB4A VB4A

3.2
VB4A

Component

COLOR_NONE

COLOR_BLACK
COLOR_DKGRAY
COLOR_GRAY
COLOR_BLUE
COLOR_CYAN
COLOR_GREEN
COLOR_LTGRAY
COLOR_MAGENTA
COLOR_RED
COLOR_WHITE
COLOR_YELLOW
Dates

DATE_YEAR

DATE_MONTH

Dates.DateAdd

DATE_DAY

intervalKind

DATE_WEEK
DATE_HOUR
DATE_MINUTE
DATE_SECOND
DATE_JANUARY
DATE_FEBRUARY
DATE_MARCH
DATE_APRIL
DATE_MAY
DATE_JUNE
DATE_JULY

DATE_AUGUST
DATE_SEPTEMBER
DATE_OCTOBER
DATE_NOVEMBER
DATE_DECEMBER

DATE_MONDAY
DATE_TUESDAY
DATE_WEDNESDAY
DATE_THURSDAY
DATE_FRIDAY
DATE_SATURDAY
DATE_SUNDAY
Math

PI

3.3
VB4A (Label)(Textbox)(Button)(Canvas)
(Checkbox)(Radiobutton)(Image)(PasswordTextbox)
Form

(Label)

(Textbox)

Initialize()

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

Justification

Text

TextColor

Initialize()

GotFocus()

LostFocus()

//Validate()

VB4A

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

(Button)

Justification

Text

TextColor

Enabled

Hint

Initialize()

GotFocus()

LostFocus()

Click()

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

Justification

Text

TextColor

Enabled

Image

VB4A

(Canvas)

Initialize()

Touched(x As Integer, y

(x,y)

As Integer)

BackgroundColor

Height

Width

BackgroundImage

PaintColor

Clear()

DrawCircle(x

As

(x,y) r

Integer, y As Integer, r
As String)
DrawLine(x1

As

(x1,y1)-(x2,y2)

Integer, y1 As Integer,
x2 As Integer, y2 As
Integer)
DrawPoint(x

As

(x,y)

Integer, y As Integer)
(Checkbox)

Initialize()

GotFocus()

LostFocus()

Changed()

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

Justification

Text

TextColor

Enabled

Value

Initialize()

GotFocus()

LostFocus()

Changed()

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

Justification

Text

TextColor

Enabled

Value

Initialize()

BackgroundColor

Height

Width

Picture

(Radiobutton)

(Image)

(PasswordTextbox)

Initialize()

GotFocus()

LostFocus()

BackgroundColor

Height

Width

FontBold

FontItalic

FontSize

Justification

Text

(Form)

TextColor

Enabled

Hint

Initialize()

Keyboard(keycode

VB4A

As

Integer)
VB4A

MenuSelected(caption
As String)

VB4A

TouchGesture(direction
As Integer)

BackgroundColor

Height

Width

BackgroundImage

Title

3.4
VB4A

VB4A

Log

Error(moduleName

as

String,

modulename log

String,

modulename log

String,

modulename log

message As String)
Warning(moduleName

as

message As String)
Infor(moduleName

as

message As String)
Collection

Add(item As Variant)

collection

Clear()

collection

Contains()

collection

Assertions

Count

collection

Item(index As Integer)

index

Remove(item As Variant)

item

AssertTrue(expression As Variant)

AssertFalse(expression As Variant)

4
Janekyrojaneky@gmail.com
VB4A simple

4.1
VB4A
Alias, And, As, Boolean, ByRef, Byte, ByVal, Case, Const, Date, Dim, Double, Each, Else,
ElseIf, End, Error, Event, Exit, For, Function, Get, If, In, Integer, Is, IsNot, Like, Long, Me, Static,
Step, String, Sub, Then, To, TypeOf, Until, Variant, While, Xor

4.2
VB4A <<, <, <=, =, <>, =>, >, >>, &, +, -, \, *, /, ^

4.3
4.3.1
VB4A
Boolean
Boolean true falseVB4A True False
Byte
Byte 8 -128 127
Short
Short 16 -32768 32767
Integer
Integer 32 -2147483648 2147483647
Long
Long 64 -9223372036854775808
9223372036854775808
Single
Single 32 IEEE754
Double
Double 64 IEEE754
String
String
Date

Date Java java.util.Calendar


Variant
Variant disjointunion

4.3.2
[ Static ]Dim As { , 2 As }

Static

Static

4.4

Const As =

4.5
4.5.1

+-

Mod

+-

&

<< >>

< <= > >= = <> Is IsNot Like TypeOf...Is

Not

And

Or Xor

4.5.2
Simple

4.5.3 VB4A
DoWhile
Do
Statements
While Expression
DoWhile Do While True Do

Exit Do...While
DoUntil
Do
Statements
Until Expression
DoUntil Do Until TrueDo

Exit DoUntil
Exit
Exit [Do|Event|For|Function|Property|Sub|While]
Exit
Exith
Exit Exit
Exit Do,For While
Exit
Exit EventFuction,Property Sub Exit

For Each

For Each <identifier> In <expression>


Statements
Next [<identifier>]
ForEach In
In

Exit ForEach Next

For...To
For <identifier> = Expression To Expression [Step Expression]
Statements
Next [<identifier>]
ForTo For To

= To
1 Step nn Step
step endexpression(To
Expression ) step end
expressionEnd expression n
For...To step
Exit Next

If
If Expression Then Statement [Else Statement]

If Expression Then
Statements
{ElseIf Expression Then
Statements}
[Else
Statements]
EndIf
If If True(
) Then If If
False ElseIf ElseIf
True ElseIf Then ElseIf
If ElseIf Tue Else Else

On Error
On Error
{Case Types
Statements}
[Case Eles
Statement
End Error
On Error getter
setter On Error
On Error
,On Error
On Error On Error
On Error call stack
On Error

On Error Case
Case Else On Error
runtime error error handler
RaiseEvent
RaiseEvent Identifier ([Actual Arguments])
RaiseEvent RaiseEvent Indentifier Eventhandler
RaiseEvent
event
Select
Select Express
{Case CaseExpressions
Statements}
[Case Else
Statements]
End Select

Slelect Select
Case case Select
case
case Select Statements Select expression
case expression

Case
range expression expression
To Select expression case
Comparison expressionIs Select
expression comparison expression True case
Case Else Select expression
case case
While
While Expression
Statements
End While
While While False While
Exit
PS Simple

You might also like