新手求助——如何在模块中编写正确的代码
Public Const PI As Single = 3.14159265357 '全局常量Public Const g As Single = 9.7949
Public Const P As Single = 1.25
Public Const U As Single = 1800000
Public d As Single
Public S As Single
Public h As Integer
Private Sub TEXT1_Change() '窗口F6的H
h = Form6.TEXT1.Text
Public L As Integer '窗口F6的L
Private Sub TEXT2_Change()
L = Form6.Text2.Text
Public w As Integer
Private Sub TEXT3_Change() '窗口F6的V0
w = Form6.Text3.Text
Public m As Integer '窗口F6的m
Private Sub TEXT4_Change()
m = Form6.Text4.Text
Public r As Integer
Private Sub TEXT5_Change()
r = Form3.TEXT5.Text '窗口F3的r
Public c As Integer
Private Sub TEXT6_Change()
c = Form4.TEXT6.Text '窗口F4的R
Public a As Integer '窗口F7的a
Private Sub TEXT7_Change()
a = Form7.TEXT7.Text
Public b As Integer '窗口f7的b
Private Sub TEXT8_Change()
b = Form7.TEXT8.Text
Public v As Integer
Private Sub TEXT9_Change()
v = Form8.Text9.Text '窗口F8的速度v
Public Function Re() As Long
Re = P * w * L / U
End Function
If Re <= 1 Then
d = 100
ElseIf Re > 1 Or Re <= 2 Then
d = 20
ElseIf Re > 2 Or Re <= 4 Then
d = 9
ElseIf Re > 4 Or Re <= 10 Then
d = 6
ElseIf Re > 10 Or Re <= 40 Then
d = 2
ElseIf Re > 40 Or Re <= 100 Then
d = 0.8
ElseIf Re > 100 Or Re <= 400 Then
d = 0.6
ElseIf Re > 400 Or Re <= 1000 Then
d = 0.5
ElseIf Re > 1000 Or Re <= 200000 Then
d = 0.4
Else
d = 0
Form11.Show '雷诺数过大,涉及了马赫数,不在讨论范围
End If
Public Function f() As Long
f = w * w * S * d * P / 2
End Function
End Sub
本人新手,不知道正确的代码怎么写,它是多form的全局变量和全局函数,所以用了标准模块,但是怎么找书本都找不到案例,求更改。