954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to add the first element of first array of every record

hi friendz....

I wanted to add the first element of first array of every record.
Each record has two arrays,
Each array has 5 values
In order to do that i wrote the following code in VB...

Option Explicit

Private Type feedbackdata

    FormNumberS As Integer
    Q1(0 To 4) As Byte
    Q2(0 To 4) As Byte
    FormNumberE As Integer
    
End Type
                                                                                                         

Private Sub cmdDisplay_Click()

Dim category(1 To 5) As String * 10
Dim quantity(1 To 5) As Integer

category(1) = "very poor"
category(2) = "poor"
category(3) = "good"
category(4) = "very good"
category(5) = "excellent"

Dim feedback As feedbackdata

Dim recordnum, n As Integer, a As Integer

If (Option1.Value) Then
a = 0
Open "C:/student.txt" For Random As #1 Len = Len(feedback)

For recordnum = 1 To Int(LOF(1) / Len(feedback))
Get #1, recordnum, Q1(0)
quantity(1) = Q1(0) + a
a = quantity(1)

Next recordnum


Open "C:/analysis.txt" For Append As #2

Print #2, category(1), quantity(1)

End If


I dont know why my code isnt working correctly,,,i mean its displaying the wrong sum in my "analysis.txt" file....Could you please help

dee2020
Newbie Poster
12 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You