VB 中实时错误6,那位大神,帮忙看看!
PrivateSubCommand1_Click()DimtjmAsStringDimtjsz()AsStringDimsjwjmAsStringDimsz()AsStr...
Private Sub Command1_Click()
Dim tjm As String
Dim tjsz() As String
Dim sjwjm As String
Dim sz() As String
Dim Trip As String
Dim Ab As Double
Dim A As String
Dim DMM As String
Dim qdj, XL, YL, XR, YR, DY, DX, ddy, ddx, X, Y, gc As Double
Dim wjm As String
wjm = "HYDMKZ.DAT"
DMM = Text1
'==========================================================================
Open wjm For Input As #4
Do While Not EOF(4)
Line Input #4, Trip
sz() = Split(Trip, ",")
If sz(0) = sjwjm And sz(1) = "L1" Then
XL = Val(sz(2))
YL = Val(sz(3))
Else
End If
If sz(0) = sjwjm And sz(1) = "R1" Then
XR = Val(sz(2))
YR = Val(sz(3))
Else
End If
Loop
Close #4
Const PI = 3.1415926
DX = XR - XL
DY = YR - YL
Ab = Atn(Abs(DY / DX)) * 180 / PI
If DX > 0 And DY > 0 Then A = Ab
If DX > 0 And DY < 0 Then A = 360 - Ab
If DX < 0 And DY > 0 Then A = 180 - Ab
If DX < 0 And DY < 0 Then A = 180 + Ab
Open DMM & ".CG2" For Input As #10
Open DMM + ".ZB" For Output As #3
N = 0
Do While Not EOF(10)
Line Input #10, tp
tjsz = Split(tp, ",")
qdj = tjsz(0)
gc = tjsz(1)
bz = tjsz(2)
N = N + 1
'======================================================================================
ddy = Abs(qdj) * Sin(A)
ddx = Abs(qdj) * Cos(A)
X = XL + ddx
Y = YL + ddy
If bz = "左水边" Then bz = "ZSB"
If bz = "右水边" Then bz = "YSB"
If bz = "边滩" Then bz = "BT"
If bz = "草地" Then bz = "CD"
If bz = "坎脚" Then bz = "KJ"
If bz = "坎边" Then bz = "KB"
If bz = "坎腰" Then bz = "KY"
If bz = "洲水边" Then bz = "ZHOUSB"
If bz = "江心洲" Then bz = "JXZ"
If bz = "树林地" Then bz = "SLD"
If bz = "耕地" Then bz = "GD"
If bz = "土台" Then bz = "TT"
If bz = "水下" Then bz = "SX"
If bz = "石地" Then bz = "SD"
If bz = "套水边" Then bz = "TAOSB"
If bz = "滩地" Then bz = "TD"
If bz = "塘水边" Then bz = "TSB"
If bz = "砼地" Then bz = "TONGD"
Print #3, DMM; "-"; N; Format$(X, "###.000"); ","; Format$(Y, "###.000"); ","; gc; ","; bz
Loop
Close #10
Close #3
MsgBox "计算完成,谢谢使用!", vbInformation, "FAN"
End Sub
提示出在Ab = Atn(Abs(DY / DX)) * 180 / PI 展开
Dim tjm As String
Dim tjsz() As String
Dim sjwjm As String
Dim sz() As String
Dim Trip As String
Dim Ab As Double
Dim A As String
Dim DMM As String
Dim qdj, XL, YL, XR, YR, DY, DX, ddy, ddx, X, Y, gc As Double
Dim wjm As String
wjm = "HYDMKZ.DAT"
DMM = Text1
'==========================================================================
Open wjm For Input As #4
Do While Not EOF(4)
Line Input #4, Trip
sz() = Split(Trip, ",")
If sz(0) = sjwjm And sz(1) = "L1" Then
XL = Val(sz(2))
YL = Val(sz(3))
Else
End If
If sz(0) = sjwjm And sz(1) = "R1" Then
XR = Val(sz(2))
YR = Val(sz(3))
Else
End If
Loop
Close #4
Const PI = 3.1415926
DX = XR - XL
DY = YR - YL
Ab = Atn(Abs(DY / DX)) * 180 / PI
If DX > 0 And DY > 0 Then A = Ab
If DX > 0 And DY < 0 Then A = 360 - Ab
If DX < 0 And DY > 0 Then A = 180 - Ab
If DX < 0 And DY < 0 Then A = 180 + Ab
Open DMM & ".CG2" For Input As #10
Open DMM + ".ZB" For Output As #3
N = 0
Do While Not EOF(10)
Line Input #10, tp
tjsz = Split(tp, ",")
qdj = tjsz(0)
gc = tjsz(1)
bz = tjsz(2)
N = N + 1
'======================================================================================
ddy = Abs(qdj) * Sin(A)
ddx = Abs(qdj) * Cos(A)
X = XL + ddx
Y = YL + ddy
If bz = "左水边" Then bz = "ZSB"
If bz = "右水边" Then bz = "YSB"
If bz = "边滩" Then bz = "BT"
If bz = "草地" Then bz = "CD"
If bz = "坎脚" Then bz = "KJ"
If bz = "坎边" Then bz = "KB"
If bz = "坎腰" Then bz = "KY"
If bz = "洲水边" Then bz = "ZHOUSB"
If bz = "江心洲" Then bz = "JXZ"
If bz = "树林地" Then bz = "SLD"
If bz = "耕地" Then bz = "GD"
If bz = "土台" Then bz = "TT"
If bz = "水下" Then bz = "SX"
If bz = "石地" Then bz = "SD"
If bz = "套水边" Then bz = "TAOSB"
If bz = "滩地" Then bz = "TD"
If bz = "塘水边" Then bz = "TSB"
If bz = "砼地" Then bz = "TONGD"
Print #3, DMM; "-"; N; Format$(X, "###.000"); ","; Format$(Y, "###.000"); ","; gc; ","; bz
Loop
Close #10
Close #3
MsgBox "计算完成,谢谢使用!", vbInformation, "FAN"
End Sub
提示出在Ab = Atn(Abs(DY / DX)) * 180 / PI 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询