Cvet's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
4 (0.01 per day)
Joined:
06-October 12
Profile Views:
87
Last Active:
User is offline Oct 05 2013 03:46 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Cvet has not set their status

Posts I've Made

  1. In Topic: Can't get this test score to work, what am I doing wrong

    Posted 7 Oct 2012

    View Posttrevster344, on 06 October 2012 - 04:57 PM, said:

    Convert the strings to integers, and ten perform your calculation. It should work fine. On a side note your error message does nothing but display the same message every single time you run the routine because it's not in any sort of error trap.


    thanks, got it working!
  2. In Topic: Can't get this test score to work, what am I doing wrong

    Posted 6 Oct 2012

    View PostdotINSolution, on 06 October 2012 - 08:58 AM, said:

    What really isn't working? That code seems to work fine very well here:
            Dim TestScore1 As Integer ' Test Score 1
            Dim TestScore2 As Integer ' Test Score 2
            Dim TestScore3 As Integer ' Test Score 3
            Dim TestScore4 As Integer ' Test Score 4
            Dim TestScore5 As Integer ' Test Score 5
    
            Try
    
                ' Get the scores entered by the user
    
                TestScore1 = 40
                TestScore2 = 70
                TestScore3 = 35
                TestScore4 = 69
                TestScore5 = 54
    
                ' Calculate the average score
    
                Dim average As Integer = (TestScore1 + TestScore2 + TestScore3 + TestScore4 + TestScore5) / 5
    
            Catch
            End Try
    
    


    One thing i noticed is that in your code, that function is added to TxtAverage.TextChanged, are you sure you are attaching to the right handler.


    sorry grabbed the wrong one.. this is what i have
     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            ' This prodecure calculates the average test score of five scores and displays the average in lblAverage.  
    
    
            Dim TestScore1 As Integer        ' Test Score 1  
            Dim TestScore2 As Integer        ' Test Score 2  
            Dim TestScore3 As Integer        ' Test Score 3  
            Dim TestScore4 As Integer        ' Test Score 4
            Dim TestScore5 As Integer        ' Test Score 5 
    
            Try
    
                ' Get the scores entered by the user  
    
                TestScore1 = txtTestScore1.Text
                TestScore2 = TxtTestScore2.Text
                TestScore3 = TxtTestScore3.Text
                TestScore4 = TxtTestScore4.Text
                TestScore5 = TxtTestScore5.Text
    
    
    
                ' Calculate the average score  
    
                lblAverage = (TestScore1 + TestScore2 + TestScore3 + TestScore4 + TestScore5) / 5
    
            Catch ex As Exception
    
            End Try
            'error message'
            MessageBox.Show("Must contain numbers Only")
        End Sub
    End Class
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Cvet hasn't added any friends yet.

Comments

Cvet has no profile comments yet. Why not say hello?