文件名称:vb水准测量代码
文件大小:4KB
文件格式:TXT
更新时间:2016-01-03 07:25:09
vb代码
Dim imarks% Private Sub form_load() imark = 1 End Sub Private Sub cmdcancel_Click() Dim i% For i = 1 To imark dis(i) = 0: deth(i) = 0 Next i frmmain.txtshow.Text = "水准计算结果" Unload Me End Sub Private Sub cmdok_Click() dist = Val(txtdist.Text): dh = Val(txtdeth.Text) Call adddata(imark, dist, dh) Public Sub adddata(imark As Integer, dist As Single, dh As Single) dis(imark) = dist: deth(imark) = dh frmmain.txtshow.Text = frmmain.txtshow.Text & "第" & Str(imark) & "站:" & vbCrLf frmmain.txtshow.Text = frmmain.txtshow.Text & " & 距离:" & dis(imark) & " 高差中数:" & deth(imark) & vbCrLf If imark >= nmarks Then frminput.Hide Else txtdist.Text = "": txtdeth.Text "": txtdist.setfoucs End If frminput.Caption = "观测数据输入:第" & Trim(Str(imark)) & "站" imark = imark + 1 frminput.Caption = "观测数据输入:第" & Trim(Str(imark)) & "站" End Sub Private Sub cmdcheckcalc_Click() Dim totaldeth!, closedeth!, tdist#, i% End Sub Private Sub optannex_Click() txtendpoint.Enabled = optannex.Value End Sub Private Sub optclose_Click() txtendpoint.Enabled = Not optclose.Value End Sub Private Sub optspur_Click() txtendpoint.Enabled = Not optspur.Value End Sub Dim startpoint!, ENDPOINT! Private Sub txtendpoint_LostFocus() If Not IsNumeric(txtendpoint.Text) Then MsgBox "输入的高程含有非数字字符!" txtendpoint.Text = "": txtendpoint.SetFocus Exit Sub End If If Val(txtendpoint.Text) > 5000 Or Val(txtendpoint.Text) < -100 Then MsgBox "输入的高程有误!" txtendtpoint.Text = "": txtendtpoint.SetFocus Exit Sub End If ENDPOINT = Val(txtendtpoint.Text) End Sub