1个回答
展开全部
就是文本文件读写的问题,添加一个text、label、comammad 即可
Private Sub Command1_Click()
Const pi = 3.1415
Dim s As Single
If Val(Text1) > 0 Then
s = pi * Val(Text1) ^ 2
Call bc(Val(Text1), s)
Shell "notepad " + App.Path + "\面积.txt", vbNormalFocus
Else
MsgBox "输入的半径要大于0", vbInformation, ""
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Text1 = ""
Label1.Caption = ""
Command1.Caption = "计算面积"
End Sub
Sub bc(a As Single, b As Single)
Open App.Path + "\面积.txt" For Output As #1
Print #1, "半径为" + CStr(a) + "的圆面积为:" + CStr(b)
Label1.Caption = "半径为" + CStr(a) + "的圆面积为:" + CStr(b)
Close #1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询