<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>help with a vb problem - .NET - tribe.net</title>
    <link>http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a?format=rss</link>
    <description>Tribe.net. Local Connections</description>
    <item>
      <title>Re: help with a vb problem</title>
      <link>http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#149bc19f-c92c-43b5-a740-4379c8693eb8</link>
      <description>Hey thanks psychotty. That was good advice. I ended up transfering the file contents (which was in a single column array) to the Subscripts in the assignment.... that worked  too. Thanks again.</description>
      <pubDate>Tue, 22 Nov 2005 21:43:32 GMT</pubDate>
      <guid isPermaLink="false">http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#149bc19f-c92c-43b5-a740-4379c8693eb8</guid>
      <dc:creator>cowboyangel</dc:creator>
      <dc:date>2005-11-22T21:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: help with a vb problem</title>
      <link>http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#e2c875fc-d1f1-428e-bce7-794056d80c7f</link>
      <description>It sounds to me like the last line in the file may have a blank space. What you should always do is verify that data coming in, especially from something such as a file, is in the format you are expecting.&#xD;
&#xD;
For example:&#xD;
&#xD;
Dim strLine As String = sreStreamReader.ReadLine()&#xD;
&#xD;
If IsNumeric(strLine) Then&#xD;
   intStudentScore(19) = Convert.ToInt32  (sreStreamReader.ReadLine()) &#xD;
&#xD;
Else&#xD;
   MsgBox "Line 20 is not numeric"&#xD;
   ' Throw exception or exit here.&#xD;
End IF&#xD;
&#xD;
&#xD;
Hope that helps</description>
      <pubDate>Tue, 22 Nov 2005 17:55:58 GMT</pubDate>
      <guid isPermaLink="false">http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#e2c875fc-d1f1-428e-bce7-794056d80c7f</guid>
      <dc:creator>Psychotty</dc:creator>
      <dc:date>2005-11-22T17:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: help with a vb problem</title>
      <link>http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#d03189ec-af38-437d-8a4b-9be26472f781</link>
      <description>what does the file look like that you're reading?&#xD;
&#xD;
&#xD;
Also -- if you delete the windows-form-generated code, the code snippets you post will be a slot shorter.</description>
      <pubDate>Tue, 22 Nov 2005 17:05:28 GMT</pubDate>
      <guid isPermaLink="false">http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#d03189ec-af38-437d-8a4b-9be26472f781</guid>
      <dc:creator>the Other™</dc:creator>
      <dc:date>2005-11-22T17:05:28Z</dc:date>
    </item>
    <item>
      <title>help with a vb problem</title>
      <link>http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#96e0eee5-fcfa-4a92-9ec2-df96a7fa8a75</link>
      <description>I am a beginning student in vb.got this problem that's hanging me up. I have to search a txt file with 20 array elemnts in it called "scores.txt" in the Bin folder, then list a count of all number of students who got that grade. the line in my code that debug is stopping on is &#xD;
intStudentScore(19) = Convert.ToInt32(sreStreamReader.ReadLine())&#xD;
&#xD;
what is wrong with this assignment statement or why won't this program work. When I type 72 in the input text, I should see the number 3, because that's how many students got a 72. Help&#xD;
&#xD;
here's my code:&#xD;
&#xD;
'Project name:          Scores Project&#xD;
'Project purpose:       The project displays the number of students earning&#xD;
'                       a specific score.&#xD;
'Created/revised by:    &amp;amp;lt;*************&gt;&#xD;
&#xD;
Option Explicit On &#xD;
Option Strict On&#xD;
&#xD;
Public Class frmScores&#xD;
    Inherits System.Windows.Forms.Form&#xD;
&#xD;
#Region " Windows Form Designer generated code "&#xD;
&#xD;
    Public Sub New()&#xD;
        MyBase.New()&#xD;
&#xD;
        'This call is required by the Windows Form Designer.&#xD;
        InitializeComponent()&#xD;
&#xD;
        'Add any initialization after the InitializeComponent() call&#xD;
&#xD;
    End Sub&#xD;
&#xD;
    'Form overrides dispose to clean up the component list.&#xD;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&#xD;
        If disposing Then&#xD;
            If Not (components Is Nothing) Then&#xD;
                components.Dispose()&#xD;
            End If&#xD;
        End If&#xD;
        MyBase.Dispose(disposing)&#xD;
    End Sub&#xD;
&#xD;
    'Required by the Windows Form Designer&#xD;
    Private components As System.ComponentModel.Container&#xD;
&#xD;
    'NOTE: The following procedure is required by the Windows Form Designer&#xD;
    'It can be modified using the Windows Form Designer.  &#xD;
    'Do not modify it using the code editor.&#xD;
    Friend WithEvents btnExit As System.Windows.Forms.Button&#xD;
    Friend WithEvents btnDisplay As System.Windows.Forms.Button&#xD;
    Friend WithEvents txtEnterScore As System.Windows.Forms.TextBox&#xD;
    Friend WithEvents Label1 As System.Windows.Forms.Label&#xD;
    &amp;amp;lt;System.Diagnostics.DebuggerStepThrough()&gt; Private Sub InitializeComponent()&#xD;
        Me.btnExit = New System.Windows.Forms.Button&#xD;
        Me.btnDisplay = New System.Windows.Forms.Button&#xD;
        Me.txtEnterScore = New System.Windows.Forms.TextBox&#xD;
        Me.Label1 = New System.Windows.Forms.Label&#xD;
        Me.SuspendLayout()&#xD;
        '&#xD;
        'btnExit&#xD;
        '&#xD;
        Me.btnExit.Anchor = System.Windows.Forms.AnchorStyles.None&#xD;
        Me.btnExit.Location = New System.Drawing.Point(64, 152)&#xD;
        Me.btnExit.Name = "btnExit"&#xD;
        Me.btnExit.Size = New System.Drawing.Size(121, 32)&#xD;
        Me.btnExit.TabIndex = 1&#xD;
        Me.btnExit.Text = "E&amp;amp;xit"&#xD;
        '&#xD;
        'btnDisplay&#xD;
        '&#xD;
        Me.btnDisplay.Location = New System.Drawing.Point(64, 104)&#xD;
        Me.btnDisplay.Name = "btnDisplay"&#xD;
        Me.btnDisplay.Size = New System.Drawing.Size(121, 32)&#xD;
        Me.btnDisplay.TabIndex = 0&#xD;
        Me.btnDisplay.Text = "&amp;amp;Display"&#xD;
        '&#xD;
        'txtEnterScore&#xD;
        '&#xD;
        Me.txtEnterScore.Location = New System.Drawing.Point(64, 56)&#xD;
        Me.txtEnterScore.Name = "txtEnterScore"&#xD;
        Me.txtEnterScore.Size = New System.Drawing.Size(120, 27)&#xD;
        Me.txtEnterScore.TabIndex = 2&#xD;
        Me.txtEnterScore.Text = ""&#xD;
        '&#xD;
        'Label1&#xD;
        '&#xD;
        Me.Label1.Font = New System.Drawing.Font("Tahoma", 9.0!, &#xD;
&#xD;
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&#xD;
        Me.Label1.Location = New System.Drawing.Point(64, 24)&#xD;
        Me.Label1.Name = "Label1"&#xD;
        Me.Label1.Size = New System.Drawing.Size(120, 23)&#xD;
        Me.Label1.TabIndex = 3&#xD;
        Me.Label1.Text = "Enter the Test Score"&#xD;
        '&#xD;
        'frmScores&#xD;
        '&#xD;
        Me.AutoScaleBaseSize = New System.Drawing.Size(8, 20)&#xD;
        Me.ClientSize = New System.Drawing.Size(252, 203)&#xD;
        Me.Controls.Add(Me.Label1)&#xD;
        Me.Controls.Add(Me.txtEnterScore)&#xD;
        Me.Controls.Add(Me.btnExit)&#xD;
        Me.Controls.Add(Me.btnDisplay)&#xD;
        Me.Font = New System.Drawing.Font("Tahoma", 12.0!, &#xD;
&#xD;
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))&#xD;
        Me.Name = "frmScores"&#xD;
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&#xD;
        Me.Text = "Final Exam"&#xD;
        Me.ResumeLayout(False)&#xD;
&#xD;
    End Sub&#xD;
&#xD;
#End Region&#xD;
&#xD;
    Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) &#xD;
&#xD;
Handles btnExit.Click&#xD;
        'ends the application&#xD;
        Me.Close()&#xD;
    End Sub&#xD;
&#xD;
    Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As &#xD;
&#xD;
System.EventArgs) Handles btnDisplay.Click&#xD;
&#xD;
        Dim intStudentScore() As Integer ' array element scores&#xD;
        Dim intCount As Integer ' counter variable&#xD;
        Dim intSearchGrades As Integer ' number of students to search for same grade&#xD;
        Dim sreStreamReader As IO.StreamReader&#xD;
&#xD;
        intSearchGrades = Convert.ToInt32(Me.txtEnterScore.Text)&#xD;
        'open the scores file&#xD;
        If IO.File.Exists("scores.txt") Then&#xD;
            sreStreamReader = IO.File.OpenText("scores.txt")&#xD;
            intStudentScore(19) = Convert.ToInt32(sreStreamReader.ReadLine())&#xD;
&#xD;
&#xD;
            For Each intSearchGrades In intStudentScore&#xD;
                If intSearchGrades = intStudentScore(intCount) Then&#xD;
                    intCount = intCount + 1&#xD;
                End If&#xD;
&#xD;
            Next intSearchGrades&#xD;
&#xD;
            MessageBox.Show("There are," &amp;amp; intCount &amp;amp; "," &amp;amp; "students", "Students, who &#xD;
&#xD;
got that grade", _&#xD;
                MessageBoxButtons.OK, MessageBoxIcon.Information)&#xD;
        Else&#xD;
&#xD;
            MessageBox.Show("File does not exist,", "File does not exist", _&#xD;
        MessageBoxButtons.OK, MessageBoxIcon.Information)&#xD;
&#xD;
        End If&#xD;
&#xD;
    End Sub&#xD;
&#xD;
&#xD;
End Class</description>
      <pubDate>Sat, 19 Nov 2005 23:18:56 GMT</pubDate>
      <guid isPermaLink="false">http://dotnutz.tribe.net/thread/91fd9477-4b51-456d-b3e9-d65d63c0938a#96e0eee5-fcfa-4a92-9ec2-df96a7fa8a75</guid>
      <dc:creator>cowboyangel</dc:creator>
      <dc:date>2005-11-19T23:18:56Z</dc:date>
    </item>
  </channel>
</rss>



