学校分配帮助 [英] School assignement help

查看:62
本文介绍了学校分配帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我正在为学校分配作业,并且在让程序执行计算时遇到问题.我在调试时没有收到任何错误,而且我也不知道从哪里开始.我可以发布代码,但是时间太长了...所以我将等着看是否有人可以帮助我,然后再发布它.

我认为这是我的问题,但我不确定..

Hi. I am working on an assignment for school and am having issues with getting the program to perform calculations. I don''t get any errors on debug, and I have no idea where to start. I can post code, but it is rather long...so I will wait to see if anyone is available to try to help me before posting it.

I think this snipet is my issue, but I don''t know for sure..

Private Sub btnCompareLifeOfVehicleCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompareLifeOfVehicleCost.Click
        ''This button event handler determines the SUV Gas cost,
        ''Compact Gas Cost, and the difference in the cost
        Dim intYearsOwned As Integer
        Dim blnNumberInFuelCostIsValid As Boolean = False
        Dim blnMilesTraveledPerYearIsValid As Boolean = False
        Dim blnYearsIsSelected As Boolean = False
        Dim strNumberSelected As String = ""
        Dim blnSUVMPGIsValid As Boolean = False
        Dim blnCompactCarMpgIsValid As Boolean = False
        Dim decSUVcost As Decimal
        Dim decCompactcost As Decimal
        Dim decDifference As Decimal
 
        ''Set focus on fuel cost per gallon text box
        txtFuelCostPerGallon.Focus()
        ''Call a function to ensure the number for fuel cost is valid
        blnNumberInFuelCostIsValid = ValidateNumberInFuelCost()
        ''Call a function to ensure the miles traveled per year is valid
        blnMilesTraveledPerYearIsValid = ValidateMilesTraveledPerYear()
        ''Call a function to ensure the number of years was selected
        intYearsOwned = ValidateYearsSelection(blnYearsIsSelected)
        ''Call a function to ensure the SUV MPG is valid
        blnSUVMPGIsValid = ValidateSUVMPG()
        ''Call a function to ensure the Compact Car MPG is valid
        blnCompactCarMpgIsValid = ValidateCompactCarMPG()
        ''If fuel cost per gallon, miles traveled per year, years of ownership, SUV MPG and Compact Car
        ''MPG are all valid, calculate the SUV Gas cost, Compact Car gas cost, and the difference in cost
        If (blnNumberInFuelCostIsValid And blnMilesTraveledPerYearIsValid And blnSUVMPGIsValid And blnCompactCarMpgIsValid And blnYearsIsSelected) Then
            ''Make items visible in the window
            lblSUVGasCost.Visible = True
            lblCompactGasCost.Visible = True
            lblDifferenceInCost.Visible = True
            ''Display the SUV gas cost, compact car gas cost, and difference in Cost
            lblSUVGasCost.Text = "SUV Gas Cost: " & decSUVcost.ToString("C")
            lblCompactGasCost.Text = "Compact Gas Cost: " & decCompactcost.ToString("C")
            decDifference = decSUVcost - decCompactcost
            lblDifferenceInCost.Text = "Difference in Cost: " & decDifference.ToString("C")
        End If
    End Sub

推荐答案

费罗,谢谢您的安排,使我走上了正确的道路,但我可以做到这一点,而无需承担从老师那里抄袭的假设笔记.没有所有功能和较少的编码,我可以毫无问题地完成该项目,但是此分配的说明需要这些功能.我从事基本的Visual Basic已有5年以上.这可能是我的第一个问题帖子,但是在过去的5年中,我从这里的许多人那里学到了很多东西,而这一切仅仅是通过阅读其他人的问题和他们得到的答案而实现的.
我将计算函数放在错误的位置上,而不是上面,而不是上面,我取出了所有代码.然后放入我的计算.然后运行调试.然后我一次粘贴一个函数,根据需要重新排列计算,直到发现所有错误.确切地说是3,其中之一是发布的代码.其中一个与无意中用C ++编写的部分措辞有关,而Visual Studio 2010未能抓住.最后是另一个错误调用/返回函数的情况.

问题已解决.
Firo, Thank you for sort-of getting me on the right path, but I could have done without the assumption of copying from teacher''s note. I could have completed this project with no issue without all the functions and WAY less coding, but the instructions for this assignment required those functions. I''ve been playing with basic Visual Basic for over 5 years. This might be my first question post, but I have learned a lot from many people here in the last 5 years, and all just by reading other peoples questions and the answers they got.

I placed the function for calculations in the wrong place, below this snipet instead of above it.I took out all my code. Then put my calculations in. Then ran debug. Then I pasted one function at a time back in, rearranging my calculations as needed, until I found all of my errors. 3 to be exact, one of which was with the posted code. One was related to inadvertently partially wording in C++, that Visual Studio 2010 didn''t catch. And the last was another instance of improper calling/return for a function.

Problem Solved.


这篇关于学校分配帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆