All pastes #767761 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-10 00:37 UTC
rendered paste body
Public Class Form1

  Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
    Dim sr As IO.StreamReader = IO.File.OpenText("C:\Documents and Settings\Dominicus\Desktop\posts.txt")
    Dim counter As Integer
    Do While sr.Peek <> -1
      Dim line As String
      line = sr.ReadLine()
      If line.Substring(0, 8) = "Posted by:" Then
        counter += 1
      End If
    Loop
    sr.Close()
    lstResults.Items.Add("The number of posts is " & counter)
  End Sub
End Class