Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Q1

Write a program in VB to input the date of birth and display the age of the user on behalf of system date

Dim born, today As Integer


Dim now() As String
Dim now1 As String
now1 = Date.Today
now = now1.Split("/")
born = CInt(TextBox1.Text)
today = CInt(now(2))
born = today - born
TextBox2.Text = born

Q2 Write a program in VB print the mark sheets of the students. The records of the students and their marks will
be stored in a database.

Public Class Form1


Dim NameOfStudent(10) As String
Dim ExamMarks(10) As Short
Dim Index As Integer
Dim Pass(10) As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim Exam As Short
Dim Names As String
Exam = txtExam.Text
Names = txtName.Text
Index = 0
Index = Index + 1
For Index = 0 To 10
If Exam >= 50 Then
NameOfStudent(Index) = Names
ExamMarks(Index) = Exam
End If
Next Index

End Sub
End Class

You might also like