6. Write a VB program to accept the details of student and display mark sheet details on grid control.( rollno, student name, class, sub1, sub2, sub3, total, percentage, grade)


Private Sub Command1_Click()
Static i As Integer
For j = 1 To MSFlexGrid1.Cols – 4
MSFlexGrid1.Row = i + 1
MSFlexGrid1.Col = j
MSFlexGrid1.Text = Text1.Item(j)
Text1.Item(j) = “”
Next
i = i + 1
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Dim i As Integer
Dim sum As Integer
Static j As Integer
sum = 0
MSFlexGrid1.Row = j + 1
For i = 4 To MSFlexGrid1.Col
MSFlexGrid1.Col = i
sum = sum + Val(MSFlexGrid1.Text)
Next
MSFlexGrid1.Col = MSFlexGrid1.Cols – 3
MSFlexGrid1.Text = sum
MSFlexGrid1.Col = MSFlexGrid1.Cols – 2
per = sum / 3
MSFlexGrid1.Text = per
MSFlexGrid1.Col = MSFlexGrid1.Cols – 1
If per >= 70 Then
MSFlexGrid1.Text = “Distinction”
ElseIf per < 70 And per >= 60 Then
MSFlexGrid1.Text = “First”
ElseIf per < 60 And per >= 50 Then
MSFlexGrid1.Text = “Second”
ElseIf per < 50 And per >= 40 Then
MSFlexGrid1.Text = “Pass”
Else
MSFlexGrid1.Text = “Fail”
End If
j = j + 1
Text1(1).SetFocus
End Sub

Private Sub Form_Activate()
Text1(1).SetFocus
End Sub

Private Sub Form_Load()
Dim Items(6) As String
Dim i As Integer
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = 0
MSFlexGrid1.Text = “Sr.No”
For i = 1 To MSFlexGrid1.Rows – 1
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = i
MSFlexGrid1.Text = i
Next

MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 1
MSFlexGrid1.Text = “RollNo”
MSFlexGrid1.Col = 2
MSFlexGrid1.Text = “Stud Name”
MSFlexGrid1.Col = 3
MSFlexGrid1.Text = “Class”
MSFlexGrid1.Col = 4
MSFlexGrid1.Text = “Sub1”
MSFlexGrid1.Col = 5
MSFlexGrid1.Text = “Sub2”
MSFlexGrid1.Col = 6
MSFlexGrid1.Text = “Sub3”
MSFlexGrid1.Col = 7
MSFlexGrid1.Text = “Total”
MSFlexGrid1.Col = 8
MSFlexGrid1.Text = “Percentage”
MSFlexGrid1.Col = 9
MSFlexGrid1.Text = “Grade”
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s