Click here to Skip to main content
15,910,787 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: beginner here. Pin
bjk8821-Oct-07 22:48
bjk8821-Oct-07 22:48 
GeneralRe: beginner here. Pin
Guffa21-Oct-07 23:01
Guffa21-Oct-07 23:01 
GeneralRe: beginner here. Pin
bjk8821-Oct-07 23:12
bjk8821-Oct-07 23:12 
GeneralRe: beginner here. Pin
Guffa21-Oct-07 23:48
Guffa21-Oct-07 23:48 
GeneralRe: beginner here. Pin
bjk8822-Oct-07 0:04
bjk8822-Oct-07 0:04 
AnswerRe: beginner here. Pin
Guffa22-Oct-07 0:11
Guffa22-Oct-07 0:11 
GeneralRe: beginner here. Pin
bjk8822-Oct-07 0:22
bjk8822-Oct-07 0:22 
GeneralRe: beginner here. Pin
bjk8822-Oct-07 0:44
bjk8822-Oct-07 0:44 
The code now looks like this:

Public Class Form1
Private Sub btnOutput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutput.Click

'Declare variables
Dim team As String
Dim played, won, drawn, lost, points, aveA, aveI, perc As Integer
'Create "zones" for data
Dim fmtStr As String = "{0, -15}{1, 10:N0}{2, 8:N1}{3, 8:N2}{4, 8:N3}{5, 8:N4}{6, 20:N5}{7, 20:C}{8, 8:P0}"
'Read data from football.txt
Dim sr As IO.StreamReader = IO.File.OpenText("C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Assessment2\football.txt")

'Add headers to the table
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))

team = sr.ReadLine

won = CInt(sr.ReadLine)
drawn = CInt(sr.ReadLine)
lost = CInt(sr.ReadLine)
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = CInt(sr.ReadLine)
aveI = CInt(sr.ReadLine)
perc = (won / played) * 100
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))

sr.Close()

End Sub
End Class


With the error appearing in the highlighted line.
AnswerRe: beginner here. Pin
Guffa22-Oct-07 1:59
Guffa22-Oct-07 1:59 
Questionqube rotation Pin
bapu288921-Oct-07 7:43
bapu288921-Oct-07 7:43 
AnswerRe: qube rotation Pin
Guffa21-Oct-07 10:00
Guffa21-Oct-07 10:00 
AnswerRe: qube rotation Pin
Christian Graus21-Oct-07 12:05
protectorChristian Graus21-Oct-07 12:05 
QuestionVB Text to WAV, Text to Speech, Voice recognition Pin
Robert from Florida21-Oct-07 3:42
Robert from Florida21-Oct-07 3:42 
AnswerRe: VB Text to WAV, Text to Speech, Voice recognition Pin
Christian Graus21-Oct-07 12:11
protectorChristian Graus21-Oct-07 12:11 
QuestionCPU Usage? Pin
AliAmjad21-Oct-07 3:25
AliAmjad21-Oct-07 3:25 
AnswerRe: CPU Usage? Pin
Paul Conrad21-Oct-07 8:52
professionalPaul Conrad21-Oct-07 8:52 
GeneralRe: CPU Usage? Pin
AliAmjad21-Oct-07 9:19
AliAmjad21-Oct-07 9:19 
GeneralRe: CPU Usage? Pin
Paul Conrad21-Oct-07 15:07
professionalPaul Conrad21-Oct-07 15:07 
GeneralRe: CPU Usage? Pin
AliAmjad22-Oct-07 4:28
AliAmjad22-Oct-07 4:28 
GeneralRe: CPU Usage? Pin
AliAmjad22-Oct-07 6:31
AliAmjad22-Oct-07 6:31 
GeneralRe: CPU Usage? Pin
AliAmjad22-Oct-07 8:27
AliAmjad22-Oct-07 8:27 
QuestionSub Reports Limitation Pin
Widgets21-Oct-07 0:26
Widgets21-Oct-07 0:26 
QuestionMy code will not capitalize first letter of line Pin
Jesi52320-Oct-07 9:07
Jesi52320-Oct-07 9:07 
AnswerRe: My code will not capitalize first letter of line Pin
Luc Pattyn20-Oct-07 9:25
sitebuilderLuc Pattyn20-Oct-07 9:25 
GeneralRe: My code will not capitalize first letter of line Pin
Jesi52320-Oct-07 9:41
Jesi52320-Oct-07 9:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.