I really need some help with this program. I have to load a text file into the form and then average the daily totals. Here is how it should look like a table:
(column headings)0:00 2:00 4:00 6:00 8:00 10:00 12:00 (etc.,up to 22:00)
Sun. 32 33 31 35 37 42 44 --- 39.25 (this is avg)
Mon. 33 32 31 33 33 32 31 --- 32.22
(etc. days are row headings -through the days of the week - numbers line up under column headings with average at end of row)
I have to load it at form load and use a For Next nested loop and put it into a list box.
Here is the code I have so far:
PublicClass EX611
Inherits System.Windows.Forms.Form
Dim intPollen(6, 11) AsShort
PrivateSub EX611_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim intHourCount AsInteger
Dim intDayCount AsInteger
Dim intDaySum AsInteger
Dim strItem AsString
FileOpen(1, CurDir() & "\pollen.txt", OpenMode.Input)
For intDayCount = 0 To 6
For intHourCount = 0 To 11
Input(1, intPollen(intDayCount, intHourCount))
intDaySum = intDaySum + intPollen(intDayCount, intHourCount)
strItem = strItem & vbTab & CStr(intPollen(intDayCount, intHourCount)
Next intHourCount
lstEntries.Items.Add(strItem)
Next intDayCount
EndSub
It's not loading correctly and I don't know how to do the headings either. I've worked on this for hours. Please help.
My text file has entries like this:
32,33,31,35,37,42,44
(column headings)0:00 2:00 4:00 6:00 8:00 10:00 12:00 (etc.,up to 22:00)
Sun. 32 33 31 35 37 42 44 --- 39.25 (this is avg)
Mon. 33 32 31 33 33 32 31 --- 32.22
(etc. days are row headings -through the days of the week - numbers line up under column headings with average at end of row)
I have to load it at form load and use a For Next nested loop and put it into a list box.
Here is the code I have so far:
PublicClass EX611
Inherits System.Windows.Forms.Form
Dim intPollen(6, 11) AsShort
PrivateSub EX611_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim intHourCount AsInteger
Dim intDayCount AsInteger
Dim intDaySum AsInteger
Dim strItem AsString
FileOpen(1, CurDir() & "\pollen.txt", OpenMode.Input)
For intDayCount = 0 To 6
For intHourCount = 0 To 11
Input(1, intPollen(intDayCount, intHourCount))
intDaySum = intDaySum + intPollen(intDayCount, intHourCount)
strItem = strItem & vbTab & CStr(intPollen(intDayCount, intHourCount)
Next intHourCount
lstEntries.Items.Add(strItem)
Next intDayCount
EndSub
It's not loading correctly and I don't know how to do the headings either. I've worked on this for hours. Please help.
My text file has entries like this:
32,33,31,35,37,42,44