Wednesday 5 February 2014

Code for compare two numbers..

Design form :-
1. Select 2 text box
2. Select 1 command button..

Code :-

Private sub command1_click()
Dim a,b As Integer
a=val(Text1.Text)
b=val(Text2.Text)
If a>b
MsgBox "A is greater then B"
Else
MsgBox "B is greatee then A"
End If
End Sub

Thursday 30 January 2014

Print the value from 10 to 1

Design Form :-
1. Select one command button on form.

Private Sub Command1_Click()
Dim i As Integer
i =10
Do While i>=1
Print i
i = i-1
Loop
End Sub

Count the digit

Design Form :-
1. Select one command button on form.

Now double click on command button then type that code :-

Private Sub Command1_Click()

Dim n As Integer, a As Integer, k As Integer

n =inputbox("enter the number");

while(n>0)
a=n mod 10
k=k+1
n=int(n/10)
wend
print k