注册 登录
编程论坛 VB.NET论坛

求助?急!

yuxinwei 发布于 2008-05-25 16:26, 702 次点击
以下是中的程序,不知道错在什么地方?请高手支招啊!
Const PI As Double = 3.1415926
        Dim i As Integer = 0
        Dim dou1 As Double = Me.TextBox2.Text
        Dim r As Double = Double.Parse(dou1)
        Dim dou2 As Double = Me.TextBox3.Text
        Dim h As Double = Double.Parse(dou2)
        Dim s As Double = 0, v As Double = 0, s1 As Double = 0, s2 As Double = 0,
        i = Integer.Parse(Me.TextBox1.Text)
        Select Case i
            Case 1
                s1 = PI * r * r
                Me.Label8.Text = "圆柱的底面积为" + s1.ToString()
            Case 2
                s2 = 2 * PI * r * h
                Me.Label8.Text = "圆柱的侧面积为" + s2.ToString()
            Case 3
                s = PI * r * r + 2 * PI * r * h
                Me.Label8.Text = "圆柱的总面积为" + s.ToString()
            Case 4
                v = PI * r * r * h
                Me.Label8.Text = "圆柱的体积为" + v.ToString()


调试时说S  V  S1  S2未定义,不是很明白,请指教!
2 回复
#2
lisypro2008-05-27 13:30
定义一下试试
#3
xuegao2008-05-27 18:21
Dim s As Double = 0, v As Double = 0, s1 As Double = 0, s2 As Double = 0, 改为Dim s As Double = 0, v As Double = 0, s1 As Double = 0, s2 As Double = 0
多了个逗号
1