这里有一段vb代码 不知道为什么不能在vs2005中运行
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim a, b, c, dert As Integer
Dim p, r, x1, x2 As Integer
Dim str As String
str = Chr(10) & Chr(13)
a = Val(TextBox1.Text)
If a = 0 Then MsgBox("a不能为0") : Exit Sub
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)
dert = b * b - 4 * a * c
p = -b / (2 * a)
If dert >= 0 Then
If dert > 0 Then
r = Math.Sqrt(dert) / (2 * a)
x1 = p + r
x2 = p - r
Else
x1 = p
x2 = p
End If
Label8.Caption = "x1" & x1 & str & "x2" & x2
Else
r = Math.Sqrt(-dert) / (2 * a)
Label8.Caption = "x1" & p & "i" & str & "x2" & p & "-" & r & "i"
End If
End Sub
请大家帮忙找找错
我用的是vs2005中的vb --------------------编程问答-------------------- 代码这么长,你不能运行是什么原因,调试一下吧 --------------------编程问答-------------------- Label8.Caption 不对,应该用Label8.text --------------------编程问答-------------------- 你想实现什么功能呀???
补充:VB , 基础类