Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
End Sub
End Sub
End Sub
End Sub
Private Sub Command9_Click()
If Len(Text1.Text) = 0 Then Exit Sub
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)
End Sub
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Q3. Draw a circle which can shink, expand, erase
and exit.
Dim s As Integer
Public Function display(s)
s=0
n = Val(Text1.Text)
While n > 9
s=0
While n > 0
r = n Mod 10
s=s+r
n = n \ 10
Wend
n=s
Wend
display = s
End Function
End Sub
Dim a, b As Integer
a = Text1.Text
b = (a * 9 / 5) + 32
MsgBox "fahrehneit " & b
End Sub
Q12. VB PROGRAM THAT TAKE DOB FRO USER
AND FIND OUT THE EXACT AGE
Private Sub Command1_Click()
Dim bday As Date, target As Date
Dim numMo As Integer, numYrs As Integer,
numDays As Integer
Dim tmpDate As Date
bday = #5/28/1979#
target = Date
If target <= bday Then
MsgBox "Invalid date"
Exit Sub
End If
numYrs = DateDiff("yyyy", bday, target)
tmpDate = DateAdd("yyyy", numYrs, bday)
If tmpDate > target Then
numYrs = numYrs - 1
tmpDate = DateAdd("yyyy", -1, tmpDate)
End If
numMo = DateDiff("m", tmpDate, target)
tmpDate = DateAdd("m", numMo, tmpDate)
If tmpDate > target Then
numMo = numMo - 1
tmpDate = DateAdd("m", -1, tmpDate)
End If
numDays = DateDiff("d", tmpDate, target)
MsgBox "Years = " & numYrs & vbCrLf & "Months
= " & numMo & vbCrLf & "Days = " & numDays
End Sub
Q13 VB program to find even and odd
numbers from an array.
End Sub
End Sub
End Sub
Q18. Write a vb program to accept the details of the
book and store in database
Dim s As String
End Sub
Text1.Text.SetFocus
End Sub
Private Sub Command3_Click()
r.Close
s = "insert into book values(" & Val(Text1.Text) & ","
'&text2.text&"',"&text3.text"',"&val(text4.Text)&")"
r.open s, c, adopendynamic, adlockoptimistic
s = "select * from book"
r.open s, c, adopendynamic, adlockoptimistic
If Not r.bof And Not r.EOF Then
r.movefirst
Text1.Text = r.fields(0).Value
Text2.Text = r.fields(1).Value
Text3.Text = r.fields(2).Value
Text4.Text = r.fields(3).Value
End If
MsgBox "book added successfully!", vbInformation,
"book"
End Sub
r.Close
s = "delete from book where bno like" '&id&""'
r.open s, c, adopendynamic, adlockoptimistic
s = "select*from book"
r.open s, c, adopendynamic, adlockoptimistic
If notr.bof And Not r.EOF Then
r.movefirst
Text1.Text = r.fields(0).Value
Text2.Text = r.fields(1).Value
Text3.Text = r.fields(2).Value
Text4.Text = r.fields(3).Value
End If
MsgBox ("record deleted successfully")
End Sub
Q19. Write a program for currency conversion
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Q20. Write a program to design traffic signals
Shape2.Visible = True
Shape1.Visible = False
Shape3.Visible = False
Shape3.Visible = True
Shape2.Visible = False
Shape1.Visible = False
Else
Shape1.Visible = True
Shape2.Visible = False
Shape3.Visible = False
End If
End Sub