我做错了什么,应用程序不会运行 [英] What am I doing wrong, the app wont run
问题描述
明确选项
选项严格关闭
选项推断关闭
公共类别frmMain >
Private Sub Button2_Click(发件人作为对象,e作为EventArgs)处理btnExit.Click
Me.Close()
结束子
私人子按钮1_Click(发件人作为对象,e作为EventArgs)处理btnDisplayCost.Click
'计算a并显示成本matress check。
Dim dblCost As Double
Integer.TryParse(txtCost.Text,dblCost)
如果radTwin.Checked = True那么
dblCost = 39.99
结束如果
如果radFull.Checked = True那么
dblCost = 49.99
结束如果
如果radQueen.Checked = True那么
dblCost = 49.99
结束如果
如果radKing.Checked =真的然后
dblCost = 69.99
结束如果
'如果未检查strore中的拾取,加上5.00的运费。
如果chkBox.Checked = True那么
dblCost = dblCost + 5.0
结束如果
End Sub
Private Sub chkBox_CheckedChanged(sender As Object,e As EventArgs)处理chkBox.CheckedChanged
如果chkBox.Checked = True那么
chkBox.Text = String.Empty
结束如果
End Sub
结束班级
我尝试过:
我有重读了Microsoft Visual Basic 2017中的整个章节。构建应用程序后,我无法让它运行。它可能是Check CheckChanged程序。
Option Explicit On
Option Strict Off
Option Infer Off
Public Class frmMain
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnDisplayCost.Click
'Calculate aand display the cost of the matress checked.
Dim dblCost As Double
Integer.TryParse(txtCost.Text, dblCost)
If radTwin.Checked = True Then
dblCost = 39.99
End If
If radFull.Checked = True Then
dblCost = 49.99
End If
If radQueen.Checked = True Then
dblCost = 49.99
End If
If radKing.Checked = True Then
dblCost = 69.99
End If
'If pick up in the strore is not checked, add the shipping fee of 5.00.
If chkBox.Checked = True Then
dblCost = dblCost + 5.0
End If
End Sub
Private Sub chkBox_CheckedChanged(sender As Object, e As EventArgs) Handles chkBox.CheckedChanged
If chkBox.Checked = True Then
chkBox.Text = String.Empty
End If
End Sub
End Class
What I have tried:
I have reread the entire chapter in Microsoft visual basics 2017. After building the application, I just can't get it to run. It may be the Check CheckChanged procedure.
推荐答案
我可以让它运行。
意味着什么 - 请记住,我们无法看到您的屏幕,访问您的硬盘或阅读您的想法 - 我们只能得到您输入的确切内容。
它可能需要你整个解决方案的其余部分才能开始了解为什么它不会运行。
所以,它会是由你决定。
幸运的是,你有一个工具可以帮助你找到正在发生的事情:调试器。一个快速的谷歌Visual Studio调试器应该为您提供开始使用它所需的信息。
在函数的第一行放置一个断点,通过调试器运行代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步执行每一行检查您预期发生的情况正是如此。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。
对不起,但我们不能为你做到这一点 - 时间让你学习一门新的(非常非常有用的)技能:调试!
means nothing - Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
And it probably needs the rest of your whole solution to begin to get any idea of why it "won't run".
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. A quick Google for "Visual Studio debugger" should give you the info you need to get started with it.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
这篇关于我做错了什么,应用程序不会运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!