我如何纠正以下 [英] How Do I Correct Following

查看:135
本文介绍了我如何纠正以下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我是ajit

我正在使用vb.net 2005。同时编译程序后显示以下错误



表达式预期

表达式不是方法

方法参数必须在paranthesis



以上编译错误的含义是什么意思



提前预订
ajit





 Private Sub btnshow_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理btnshow.Click 
Dim wa As Single
Dim hb As Single
Dim bmi As Single

wa = txtwt.Text
hb = txtht.Text
bmi =((txtwt.Text)/((txtht.Text / 3.33)*(txtht.Text / 3.33)))

如果bmi< = 18.5那么
txtbmi.Text =格式(bmi,00.00)
lbl3.Text =(你是不重的人)
ElseIf bmi > 18.5和bmi< = 24.9然后
txtbmi.Text =格式(bmi,00.00)
lbl3.Text =(你有正常的重量。)
ElseIf bmi> 24.9和bmi< = 29.9然后
txtbmi.Text =格式(bmi,00.00)
lbl3.Text =(你被超重)
ElseIf bmi> 29.9然后
txtbmi.Text =格式(bmi,00.00)
lbl3.Text =(你高度加权)
结束如果


结束Sub

解决方案

正如我在评论中写的那样......



引用:

请写出完整的错误,这样我就可以帮助您检测并纠正程序的行! / blockquote>



但是对于每个表达式的含义,我发布了一些帮助页面:



< b>表达预期: http://msdn.microsoft。 com / zh-CN / library / a5eydts0(v = vs.80).aspx



表达式不是方法: http://msdn.microsoft.com/en-us/library/ kbe8hwc2(v = vs.80).aspx



方法的参数必须处于paranthesis: http://msdn.microsoft.com/en-us/library/1xk7dw1d(V = VS。 80).aspx



现在......我已经涵盖了你的意思!如果您想要更多详细信息并修复您的代码。 :)


所以...你的问题是数学的! :)



这是你的解决方案....




打开Visual Basic Express ,单击新建项目,选择Windows应用程序作为类型,将其命名为BMI计算器,然后单击确定。将屏幕右下角的属性面板中的表单的Text属性更改为BMI Calculator。



2

创建通过双击左侧工具箱中的标签工具显示的表单上的两个标签,用大的A标识,然后重复此过程。现在点击并拖动表单上的每个标签,使其显示在另一个下面。



3

以相同的方式创建两个文本框,这次双击文本框工具。在每个标签旁边放一个方框。通过双击按钮工具创建一个命令按钮并将其放在标签下面。



4

创建第三个标签如步骤2中所示,并将其放在命令按钮旁边。使用宽度180和高度25在屏幕右侧的属性面板中设置前两个标签的大小。保持第三个标签的高度相同,但宽度为150.



5

将顶部标签的文本属性更改为以磅为单位输入您的体重,将第二个标签的文本属性更改为输入您的身高英寸。删除第三个标签的文本,并将其命名为BMIResult。将命令按钮的text属性更改为Calculate。



6

双击计算按钮打开代码窗口并在Private sub和End sub行之间输入以下代码:

  Dim  BMI  As   Single  
Dim Height As Short
Dim 权重作为
高度= CShort (Text2.Text)
权重= CShort (Text1.Text)
BMI =(权重/(Height_Renamed * Height_Renamed)) * 703
BMI = CSng (BMI)
BMIResult.Text = 您的BMI是& amp; BMI.ToString( F1







按功能键上的F5测试程序。结果应弹出计算旁边的空白处。如果是,请按CTRL + S进行保存。如果没有,请返回并检查标签的编码和名称。然后单击构建。将生成的EXE文件固定到开始菜单或将其复制到桌面。



这是主程序的帮助!https://www.youtube.com/watch?v=335LobrUI6g



不适用于您的职能....



参见该论坛: http://teachmevisualbasic.blogspot .gr / 2011/07 / lesson-7-mathematical-operations.html 和视频

引用:

https://www.youtube.com/watch?v=335LobrUI6g







我希望我能帮到你!请评价我和青睐,因为我是野心的新程序员! ;)


hello
I am ajit
I am using vb.net 2005 . while compiling the programe following errors are shown

expression expected
expression is not a method
argument of method must be in paranthesis

what is the meaning of above compiling error

thsnks in advance
ajit

[EDIT - OP's code from soon to be deleted solution]

Private Sub btnshow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnshow.Click
    Dim wa As Single
    Dim hb As Single
    Dim bmi As Single

    wa = txtwt.Text
    hb = txtht.Text
    bmi = ((txtwt.Text) / ((txtht.Text / 3.33) * (txtht.Text / 3.33)))

    If bmi <= 18.5 Then
        txtbmi.Text = Format(bmi, " 00.00")
        lbl3.Text = (" YOU ARE UNER WEIGHT ")
    ElseIf bmi > 18.5 And bmi <= 24.9 Then
        txtbmi.Text = Format(bmi, "00.00")
        lbl3.Text = (" YOU HAVE NORMAL WEIGHT .")
    ElseIf bmi > 24.9 And bmi <= 29.9 Then
        txtbmi.Text = Format(bmi, "00.00")
        lbl3.Text = (" YOU ARE OVERWEIGHTED ")
    ElseIf bmi > 29.9 Then
        txtbmi.Text = Format(bmi, "00.00")
        lbl3.Text = (" YOU ARE HIGHLY WEIGHTED ")
    End If


End Sub

解决方案

As i wrote you in the comment...

Quote:

please write the full errors so i can help you detect and correct the lines of your programm!



But for the meaning of each expression I post you some help pages :

expression expected : http://msdn.microsoft.com/en-us/library/a5eydts0(v=vs.80).aspx

expression is not a method : http://msdn.microsoft.com/en-us/library/kbe8hwc2(v=vs.80).aspx

argument of method must be in paranthesis : http://msdn.microsoft.com/en-us/library/1xk7dw1d(v=vs.80).aspx

Now...I have cover you with the meanings! If you want more details and fixes post your code. :)


so...your problem is mathematic! :)

here is your solution....


Open Visual Basic Express, click on "New project," select "Windows application" as the type, name it "BMI Calculator" and click "OK." Change the Text property of the form in the Properties panel on the bottom right of the screen to "BMI Calculator."

2
Create two labels on the form that appears by double-clicking on the label tool in the toolbox on the left, identified with a large "A" and then repeating this process. Click and drag each label now on the form so that one appears under the other.

3
Create two text boxes in the same way, this time double-clicking on the "Textbox" tool. Place one box next to each label. Create a command button by double-clicking on the "Button" tool and place it below the labels.

4
Create a third label as in Step 2 and locate it next to the command button. Set the size of the first two labels in the Properties panel on the right of the screen using a width of 180 and a height of 25. Keep the third label the same height, but make the width 150.

5
Change the text property of the top label to read "Enter your weight in pounds" and the text property of the second label to read "Enter your height in inches." Delete the text for the third label and make the name "BMIResult." Change the text property of the command button to read "Calculate."

6
Double-click on the "Calculate" button to open the code window and enter the following code between the "Private sub" and "End sub" lines:

Dim BMI As Single
Dim Height As Short
Dim Weight As Short
Height = CShort(Text2.Text)
Weight = CShort(Text1.Text)
BMI = (Weight / (Height_Renamed * Height_Renamed)) * 703
BMI = CSng(BMI)
BMIResult.Text = "Your BMI is " &amp; BMI.ToString("F1")



7
Test the program by pressing "F5" on the function keys. The result should pop up in the blank space next to "Calculate." If it does, press "CTRL + S" to Save. If not, go back and check the coding and names of the labels. Then click "Build." Pin the resulting EXE file to the Start menu or copy it to the Desktop.

That is for the main program!More help at https://www.youtube.com/watch?v=335LobrUI6g and

Νοw for your function....

see that forum : http://teachmevisualbasic.blogspot.gr/2011/07/lesson-7-mathematical-operations.html and the video

Quote:

https://www.youtube.com/watch?v=335LobrUI6g




I hope i helped you! Please rate me and fav, cause i am a new programer with ambitions! ;)


这篇关于我如何纠正以下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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