需要帮助计算气缸容积 [英] Need Help Computing Volume of Cylinder
问题描述
大家好,我有一个任务,创建一个简单的VB程序,
计算一个柱面的音量。表单非常简单,它有一个
标签和基本半径的文本框,另一个用于高度,另一个用于
音量,带有OK按钮。我有代码放入OK按钮(
我已经完成):
Private Sub OK_Click() - 不是这一行
r = Val(radius.Text) - 输入这一行
h = Val(hght.Text) - 输入这一行
pi = 22 / 7 - 输入这一行
v = pi *(r ^ 2)* h - 输入这一行
volume.Text = Str $(v) - 输入这一行
结束子 - 不是这一行
当我去运行Build时,它抱怨我还没有声明变量
那个你看到上面。我在哪里转到那个?我假设在标签或
文本框中为基本半径,等等,但是哪一个?我怎么键入
到它们中语法正确以匹配我给的代码
使用?
我是使用VB.NET 2003 SE。如果我需要发布更多代码,请告诉我,
以及我从哪里发布。
非常感谢您的帮助。
Hi everyone, I have an assignment, to create a simple VB program that
computes the volume of a cylinder. The Form is pretty simple, it has a
label and text box for base radius, another for height and another for
volume with an OK button. I have the code to put into the OK button (Which
I''ve done):
Private Sub OK_Click( ) --not this line
r = Val(radius.Text) --input this line
h = Val(hght.Text) --input this line
pi = 22 / 7 --input this line
v = pi * (r ^ 2) * h --input this line
volume.Text= Str$(v) --input this line
End Sub --not this line
When I go to run the Build, it complains I have not declared the variables
that you see above. Where do I goto do that? I assume under the label or
text box for the base radius, and so forth, but which one? What do I key
into them that is syntactically correct to match the code I was given to
use?
I am using VB.NET 2003 SE. Please let me know if I need to post more code,
and where I would get it from to post.
My many thanks for any assistance.
推荐答案
(v) - 输入此行
结束子 - 不在此行
当我去运行Build时,它抱怨我没有声明你在上面看到的变量
。我在哪里转到那个?我假设在标签或
文本框中为基本半径,等等,但是哪一个?我怎么键入
到它们中语法正确以匹配我给的代码
使用?
我是使用VB.NET 2003 SE。如果我需要发布更多代码,请告诉我,
以及我从哪里发布。
非常感谢您的帮助。
(v) --input this line
End Sub --not this line
When I go to run the Build, it complains I have not declared the variables
that you see above. Where do I goto do that? I assume under the label or
text box for the base radius, and so forth, but which one? What do I key
into them that is syntactically correct to match the code I was given to
use?
I am using VB.NET 2003 SE. Please let me know if I need to post more code,
and where I would get it from to post.
My many thanks for any assistance.
尝试类似这样的事情(未经测试)
Private Sub OK_Click() - 不是这一行
dim r as double = Val(radius.Text) - 输入此行
dim h as double = Val(hght.Text) - 输入此行
dim v as double = MATH.PI *(r ^ 2)* h - 输入此行
volume.Text = Str
Try something like this ( Untested )
Private Sub OK_Click( ) --not this line
dim r as double = Val(radius.Text) --input this line
dim h as double= Val(hght.Text) --input this line
dim v as double =MATH.PI * (r ^ 2) * h --input this line
volume.Text= Str
(v) - 输入这条线
结束子 - 不是这一行
-
OHM(特里伯恩斯)
http://TrainingOn.net
" ; Basil Fawlty <巴*************** @ NOSPAMyahoo.com>在消息中写道
新闻:lf ******************** @ comcast.com ...
(v) --input this line
End Sub --not this line
--
OHM ( Terry Burns )
http://TrainingOn.net
"Basil Fawlty" <Ba***************@NOSPAMyahoo.com> wrote in message
news:lf********************@comcast.com...
你好每个人,我有一个任务,创建一个简单的VB程序,
计算一个圆柱体积。表单非常简单,它有一个
标签和基本半径的文本框,另一个用于高度,另一个用于带有OK按钮的
卷。我将代码放入OK按钮
(我已经完成了):
Private Sub OK_Click() - 不是这行
r = Val(radius.Text) - 输入此行
h = Val(hght.Text) - 输入此行
pi = 22/7 - 输入此行
v = pi *(r ^ 2)* h - 输入此行
volume.Text = Str
Hi everyone, I have an assignment, to create a simple VB program that
computes the volume of a cylinder. The Form is pretty simple, it has a
label and text box for base radius, another for height and another for
volume with an OK button. I have the code to put into the OK button
(Which
I''ve done):
Private Sub OK_Click( ) --not this line
r = Val(radius.Text) --input this line
h = Val(hght.Text) --input this line
pi = 22 / 7 --input this line
v = pi * (r ^ 2) * h --input this line
volume.Text= Str
这篇关于需要帮助计算气缸容积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!