Documente Academic
Documente Profesional
Documente Cultură
Then the start window will be displayed. There are three buttons
New, Existing and Recent. At present we are interested to open a
project which already exists. We may click on existing or recent.
1
There are three button in project explorer window view code, view
object (to see the form), toggle folders.
2
routine (event procedure) then event goes unhandled. A few
events are clicked, double clicked, key press, key down etc.
All the controls have colors, front size 14 and bold. The code
window will look like the following:
Label6.Caption=Label1.Caption
Text Messege.Text=Label2.Caption
3
End Sub
Write the code for change event of the Text Box. The code
will be the following:
End If
End Sub
4
command will be executed. When command button is selected
and its cancel property is set to true. The command button can be
chosen by pressing ESC key.
6
We write time interval for the timer in form load event as
Timer1.Interval =1000
Example- Suppose you have five labels with name lbl and we
want right click event for the elements of the array. Such that
caption of some another label with name output will be same as
the label at which mouse was clicked. The code will be following.
Output.Caption=Lbl(index).Caption
End Sub
If conditions Then
…………………………………………………………
7
…………………………………………………………
End If
I = 100
End If
Notice the single line form of If-Then statement does not use an
End If statement. If you want to execute more than one line of
code then condition is true. You must use multiple line block.
If-Then-End If syntax:
1. If i>100 Then
i=100
End If
8
3. If-Then-Else
If condition Then
[statement block_1]
[statement block_2]
Else
[statement block_n]
End If
9
Error- A string containing the word error followed by the
error number
Rate = “12.75”
B = 1234567.897
C = 123
Then Len(A) will return 4, Len(B) will return 8, Len(C) will return 4.
10
Note: Items within third bracket are optional
Example- Dim Star As String
Star = “XXpXXpXXPXXP”
Here we want to search first occurrence of P**. If first position is
omitted it is assumed one.
We write-2>InStr(Star “p”)
Will return 9
Dim I as integer
I = InStr(name, “ ”)-1
11
Function me) leading and trailing blanks
Example- File name contain Drive, directory path, file name and
extension like D:\abc\def\pqr.qrs
s1= “ABCD”
s2= “XYZ”
s3= s1&s2
Case 0 To 59
Case 60 To 69
Case 70 To 79
13
Case 80 To 89
Lblres.Caption = “Great”
Case Else
Lblres.Caption = “Perfect”
Ex- we want that only digit (-) minus ,(.)dot will be allowed to
enter in a text box in the key press event of the text box. We may
write-
Case Else
Key ASC II = 0
Beep
End Select
14
executed until some conditions is satisfied or in other words we
can say the loop can be repeated a block of codes.
a. Do While Condition
c. Loop
I=1
Sum = 0
Do While I <= 10
Sum =Sum + I
I=I+1
Loop
It will calculate the first ten natural numbers, to display the sum
LblSum.Caption = Sum.
15