Professional Documents
Culture Documents
P Coding
P Coding
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Text1.Text = 10
End Sub
Shape2.Visible = True
Shape1.Visible = False
Shape3.Visible = False
ElseIf Shape2.Visible Then
Shape3.Visible = True
Shape2.Visible = False
Shape1.Visible = False
ElseIf Shape3.Visible Then
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
End If
End Sub
123
1234
12345
If num>0 Then
Ans=num*2
Else
Unload me
Endif
Tet1.text=ans
Form1.Backcolor=vbBlue
End Sub
34.WAP which accept a no. and display the no. of digit places.
Dim a as integer
Private sub command1.click()
If a<0 Then
For num=1 to 10
Print2*;num;=;2*num
Nextnum
End Sub
Print 5*num
Nextnum
End Sub
37. WAP with the two textboxes and two option buttons,when
user enters no. in text1 and text2 display the square and
square root depending on option button selected.
Dim a as integer
MsgboxLength of string:&Len(a)
End Sub
Private Sub Command2_click()
Text2.Text=StrReverse(a)
End Sub
Private Sub Command3_click()
Unload me
End Sub
Private Sub Form_Load()
Form1.Backcolor=RGB(102,255,51)
End Sub
Private Sub Text1_change()
a=Text1.Text
End Sub
Print fac(a)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
End Sub
42. WAP of Mousemove event in which when you move the mouse on the form, the
block of code in the mousemove event procedures is executed.As a result the form
becomes larger in size.
Private Sub Form_Mousemove(Button as integer,shift as integer,x as single,y as single)
Form1.Height=Form1.Height+5
Form1.Width=Form1.Width+5
End Sub
str = "+"
End Sub
Text1.Text = ""
str = "/"
End Sub
44.WAP contain a textbox and enter a number if no. is greater then 0 then print
num*2.
Private Sub Form_Load()
Dim num As Integer, ans As Integer
num = InputBox("enter a number")
If num > 0 Then
ans = num * 2
Else
Unload Me
End If
Text1.Text = ans
Form1.BackColor = ubblue
End Sub
Public Function intrest(ByVal pri As Double, ByVal rat As Double, ByVal yr As Double)
Dim p, r, y, ci As Double
Dim re As Double
re = (1 + (rat / 100)) ^ yr
re = pri * re
intrest = re
End Function
End Function
47. Create two forms to display details from the table product and supplier of the
database. Display these via menu option of MDI application.
FOR MDI FORM:Private Sub ex_Click()
Unload Me
End Sub
Private Sub pro_Click()
Form1.Show
End Sub
Private Sub sup_Click()
Form2.Show
End Sub
48. Create an application that determine the future value of an investment at a given
rate for a given number of years, and display the future value in currency format.
Private Sub Command1_Click()
Dim amt As Integer, rate As Integer, fvalue As Long, time As Integer
amt = Text1.Text
rate = Text2.Text
time = Text3.Text
fvalue = amt * (1 + rate / 100) ^ time
Text4.Text = FormatCurrency(fvalue, -1)
End Sub
Me.BackColor = vbGreen
End Sub
49. Create an application using array of option control for changing the form back
color.
Dim m As Long
Private Sub Command1_Click()
Me.BackColor = m
End Sub
50. Create an application using data grid control show the details of the table book.
Private Sub Form_Load()
Me.BackColor = vbBlue
End Sub
Private Sub mnu_ex_Click()
Unload Me
End Sub