Re: VBDot Net Maths Problem

  • From: "Marvin Hunkin" <startrekcafe@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 29 Sep 2008 16:11:41 +1000

        Hi.
yes, did do that, did redo the example, and got it working, and now is all 
fine with that project.
vb is a bit funny with functions calls, and the code, for the click events, 
and it works.
thanks for all your help and suggestions.
off to do the finance project, and see if i can get that working.
cheers Marvin.
----- Original Message ----- 
From: "black ares" <matematicianu2003@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, September 29, 2008 4:04 PM
Subject: Re: VBDot Net Maths Problem


the problem is here:
you declare intscoreone intscoretwo, but when you call the findaverage you
say
findAverage(scoreoneinteger,scoretwointeger,scorethreeinteger)
these 3 variables are not declared in the method or as global variables.

    Private Sub CalculateToolStripMenuItem_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles CalculateToolStripMenuItem.Click


        ' Calculate individual and summary info.

        Dim decAverage As Decimal
        dim decHandicap as Decimal
                Dim intSeries as integer
                dim intScoreOne as integer
                dim intScoreTwo as integer
                dim intScoreThree As Integer
                        Dim strHighGame As String
dim strName as string


        Try
            With Me
                strName = Integer.Parse(tbNameTextBox.Text)
                strHighGame=Integer.Parse(tbHighGameTextBox.Text)
                                intScoreOne =
Integer.Parse(tbGameOneTextBox.Text)
                intScoreTwo = Integer.Parse(tbGameTwoTextBox.Text)
                intScoreThree = Integer.Parse(tbGameThreeTextBox.Text)
                intSeries=Integer.Parse(tbSeriesTextbox.Text)
                decAverage=Decimal.Parse(tbAverageTextbox.Text)
                decHandicap=Decimal.Parse(tbHandicapTextBox.Text)

                ' Perform all calculations.

                decAverage = FindAverage(ScoreOneInteger, ScoreTwoInteger,
ScoreThreeInteger)

----- Original Message ----- 
From: "Marvin Hunkin" <startrekcafe@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, September 29, 2008 3:45 AM
Subject: VBDot Net Maths Problem


> Hi.
> well, working on a project for a bowling club.
> and changed the variable names for the private function calls, and went
> through character by character.
> and also determined the correct variable value, but still not liking the
> private function calls and the text boxes, and the check box, saying it is
> not declared.
> but i have had a double check, and made sure.
> so why am i getting these errors?
> will paste the error window and my sub routine block, see if any one can
> help me out and why vb.is complaining.
> or am i doing some thing stupid or wrong or just being a dummy?
> this is really starting to annoy me.
> cheers Marvin.
>
> Error 1 Name 'ScoreThreeInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 14 45 Bowling
> Error 2 Name 'tbHighGameTextBox' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 67 43 Bowling
> Error 3 Name 'tbSeriesTextbox' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 71 41 Bowling
> Error 4 Name 'tbHandicapTextBox' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 73 43 Bowling
> Error 5 Name 'ScoreOneInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 77 42 Bowling
> Error 6 Name 'ScoreTwoInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 77 59 Bowling
> Error 7 Name 'ScoreThreeInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 77 76 Bowling
> Error 8 Name 'ScoreOneInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 78 40 Bowling
> Error 9 Name 'ScoreTwoInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 78 57 Bowling
> Error 10 Name 'ScoreThreeInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 78 74 Bowling
> Error 11 Name 'ScoreOneInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 79 44 Bowling
> Error 12 Name 'ScoreTwoInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 79 61 Bowling
> Error 13 Name 'ScoreThreeInteger' is not declared.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 79 78 Bowling
> Error 14 'tbHighGameTextBox' is not a member of 'Bowling.frmBowling'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 89 17 Bowling
> Error 15 Argument not specified for parameter 'index' of 'Public ReadOnly
> Default Property Chars(index As Integer) As Char'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 89 43 Bowling
> Error 16 'tbSeriesTextbox' is not a member of 'Bowling.frmBowling'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 90 17 Bowling
> Error 17 'tbHandicapTextBox' is not a member of 'Bowling.frmBowling'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 91 17 Bowling
> Error 18 'chkMaleCheckBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 146 17 Bowling
> Error 19 'chkFemaleCheckBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 147 17 Bowling
> Error 20 'tbGameOneTextbox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 148 17 Bowling
> Error 21 'tbGameTwoTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 149 17 Bowling
> Error 22 'tbGameThreeTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 150 17 Bowling
> Error 23 'tbAverageTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 151 17 Bowling
> Error 24 'tbHandicapTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 152 17 Bowling
> Error 25 'tbSeriesTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 153 17 Bowling
> Error 26 'tbHighGameTextBox' is not a member of
> 'System.Windows.Forms.TextBox'.
> C:\DOCS\Tafe\CertificateFourProgramming\CertFour\Programming\VisualBasic\Book\VisualBasicProgramming\ChapterFive\Example\Bowling\Bowling\frmBowling.vb
> 154 17 Bowling
>
>
> 'Programmer: Bradley/Millspaugh
> 'Date: June 2005
> 'Folder: Ch05Bowling
> 'Description: This project calculates bowling statistics using
>
>
> Public Class frmBowling
>
>
> Private Function FindAverage(ByVal ScoreOneInteger As Integer, _
> ByVal ScoreTwoInteger as integer, ByVal ScoreThreInteger as Integer) As
> Decimal
>    ' Return the average of three games.
> Return (ScoreOneInteger + ScoreTwoInteger + ScoreThreeInteger)
> End Function
> Private Function FindHandicap(ByVal AverageDecimal As Decimal) As Decimal
>        ' Calculate the handicap.
> Return (200D - AverageDecimal) * 0.8D
>    End Function
> Private Function FindSeries(ByVal ScoreOneInteger As Integer, _
>    ByVal ScoreTwoInteger As Integer, ByVal ScoreThreeInteger As Integer)
> As
> Integer
>        ' Calculate the series total.
>        Return ScoreOneInteger + ScoreTwoInteger + ScoreThreeInteger
>    End Function
>    Private Function FindHighGame(ByVal ScoreOneInteger As Integer, _
>    ByVal ScoreTwoInteger As Integer, ByVal ScoreThreeInteger As Integer)
> As
> String
>        ' Find the highest game in the series.
>        If ScoreOneInteger > ScoreTwoInteger And ScoreOneInteger >
> ScoreThreeInteger Then
>            Return "1"
>        ElseIf ScoreTwoInteger > ScoreOneInteger And ScoreTwoInteger >
> ScoreThreeInteger Then
>            Return "2"
>        ElseIf ScoreThreeInteger > ScoreOneInteger And ScoreThreeInteger >
>ScoreTwoInteger Then
>            Return "3"
>        Else
>            Return "Tie"
>        End If
>    End Function
>
>
>
>
>
>
>
>
>
>
>
>    Private Sub CalculateToolStripMenuItem_Click(ByVal sender As Object,
> ByVal e As System.EventArgs) Handles CalculateToolStripMenuItem.Click
>
>
>        ' Calculate individual and summary info.
>
>        Dim decAverage As Decimal
>        dim decHandicap as Decimal
>                Dim intSeries as integer
>                dim intScoreOne as integer
>                dim intScoreTwo as integer
>                dim intScoreThree As Integer
>                        Dim strHighGame As String
> dim strName as string
>
>
>        Try
>            With Me
>                strName = Integer.Parse(tbNameTextBox.Text)
>                strHighGame=Integer.Parse(tbHighGameTextBox.Text)
>                                intScoreOne =
> Integer.Parse(tbGameOneTextBox.Text)
>                intScoreTwo = Integer.Parse(tbGameTwoTextBox.Text)
>                intScoreThree = Integer.Parse(tbGameThreeTextBox.Text)
>                intSeries=Integer.Parse(tbSeriesTextbox.Text)
>                decAverage=Decimal.Parse(tbAverageTextbox.Text)
>                decHandicap=Decimal.Parse(tbHandicapTextBox.Text)
>
>                ' Perform all calculations.
>
>                decAverage = FindAverage(ScoreOneInteger, ScoreTwoInteger,
> ScoreThreeInteger)
>                intSeries = FindSeries(ScoreOneInteger, ScoreTwoInteger,
> ScoreThreeInteger)
>                strHighGame = FindHighGame(ScoreOneInteger,
> ScoreTwoInteger,
> ScoreThreeInteger)
>                decHandicap = FindHandicap(decAverage)
>
>                ' Format the output.
>
>                .tbNameTextBox.Text = strName.ToString()
>                .tbGameOneTextBox.Text = intScoreOne.ToString("N1")
>                .tbGameTwoTextBox.Text = intScoreTwo.ToString("N1")
>                .tbGameThreeTextBox.Text = intScoreThree.ToString("N1")
>                .tbAverageTextBox.Text = decAverage.ToString("N1")
>                .tbHighGameTextBox.Text = strHighGame()
>                .tbSeriesTextbox.Text = intSeries.ToString()
>                .tbHandicapTextBox.Text = decHandicap.ToString("N1")
>
>
>
>
>
>
>
>
>            End With
>        Catch ex As Exception
>            MessageBox.Show("Please Enter three numeric scores", "Missing
> Data", _
>            MessageBoxButtons.OK)
>
>        End Try
>
> End Sub
>
>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: