📄 ucmerestone.vb
字号:
Me.Panel_Bottom.ResumeLayout(False)
Me.Panel_Fill.ResumeLayout(False)
Me.GroupBox_fwwmc.ResumeLayout(False)
Me.GroupBox_cfwj.ResumeLayout(False)
Me.GroupBox_jl.ResumeLayout(False)
Me.GroupBox_fwwmc1.ResumeLayout(False)
CType(Me.MereStoneData, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox_cfwj1.ResumeLayout(False)
Me.GroupBox_jl1.ResumeLayout(False)
Me.GroupBox_xh1.ResumeLayout(False)
Me.GroupBox_fwwmc2.ResumeLayout(False)
Me.GroupBox_cfwj2.ResumeLayout(False)
Me.GroupBox_jl2.ResumeLayout(False)
Me.GroupBox_xh2.ResumeLayout(False)
Me.GroupBox_fwwmc3.ResumeLayout(False)
Me.GroupBox_cfwj3.ResumeLayout(False)
Me.GroupBox_jl3.ResumeLayout(False)
Me.GroupBox_xh3.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
'记录行数
Public ReadOnly Property RowsCount()
Get
Return MereStoneData.Tables(MereStoneData.MereStone.TableName).Rows.Count
End Get
End Property
'遍历窗体控件,将控件可操作性置为“否”
Public Sub DataControlEnable(ByVal blEnabled As Boolean)
Dim ctrl As Control
For Each ctrl In Me.Panel_Fill.Controls
If TypeOf ctrl Is TextBox Then
CType(ctrl, TextBox).Enabled = blEnabled
ElseIf TypeOf ctrl Is ComboBox Then
CType(ctrl, ComboBox).Enabled = blEnabled
ElseIf TypeOf ctrl Is DateTimePicker Then
CType(ctrl, DateTimePicker).Enabled = blEnabled
End If
Next
End Sub
'按钮控制是否可操作方法
Public Sub ButtonEnable(ByVal state As String)
Select Case state
Case "modify"
btn_Save.Enabled = True
btn_Cancel.Enabled = False
Case "save", "cancel"
btn_Save.Enabled = False
btn_Cancel.Enabled = True
Case "init"
btn_Save.Enabled = RowsCount > 0
btn_Cancel.Enabled = RowsCount > 0
btn_Delete.Enabled = RowsCount > 0
End Select
End Sub
'验证是否为空
Private Function ValidateEmpty(Optional ByVal validate As String = "") As Boolean
If validate = "" Then
If txtBox_mc.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("界桩名称不能为空!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_mc.Focus()
Return False
End If
If txtBox_mc.Text.ToString.Trim().Equals("界桩-新增加") Then
MessageBox.Show("请确定界桩名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_mc.Focus()
Return False
End If
If txtBox_bh.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("界桩编号不能为空!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_bh.Focus()
Return False
End If
If txtBox_bh.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定界桩编号!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_bh.Focus()
Return False
End If
If txtBox_lx.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩类型!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_lx.Focus()
Return False
End If
If txtBox_lx.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩类型!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_lx.Focus()
Return False
End If
If txtBox_cz.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩材质!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cz.Focus()
Return False
End If
If txtBox_cz.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩材质!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cz.Focus()
Return False
End If
If txtBox_bw.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的纬度!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_bw.Focus()
Return False
End If
If txtBox_bw.Text.ToString.Trim().Equals("0°0′0″") Then
MessageBox.Show("请确定该界桩的纬度!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_bw.Focus()
Return False
End If
If txtBox_dj.Text.ToString.Trim.Length = 0 Or txtBox_dj.Text.ToString.Trim().Equals("0°0′0″") Then
MessageBox.Show("请填写该界桩的经度!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_dj.Focus()
Return False
End If
If txtBox_dj.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的经度!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_dj.Focus()
Return False
End If
If txtBox_jl1.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与一号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl1.Focus()
Return False
End If
If txtBox_jl1.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的与一号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl1.Focus()
Return False
End If
If txtBox_cfwj1.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与一号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj1.Focus()
Return False
End If
If txtBox_cfwj1.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的与一号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj1.Focus()
Return False
End If
If txtBox_fwwmc1.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的一号方位物名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_fwwmc1.Focus()
Return False
End If
If txtBox_fwwmc1.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的一号方位物名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_fwwmc1.Focus()
Return False
End If
If txtBox_jl2.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与二号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl2.Focus()
Return False
End If
If txtBox_jl2.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的与二号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl2.Focus()
Return False
End If
If txtBox_cfwj2.Text.ToString.Trim.Length = 0 Or txtBox_cfwj2.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请填写该界桩的与二号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj2.Focus()
Return False
End If
If txtBox_cfwj2.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与二号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj2.Focus()
Return False
End If
If txtBox_fwwmc2.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的二号方位物名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_fwwmc2.Focus()
Return False
End If
If txtBox_jl3.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与三号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl3.Focus()
Return False
End If
If txtBox_jl3.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的与三号方位物的距离!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_jl3.Focus()
Return False
End If
If txtBox_cfwj3.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的与三号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj3.Focus()
Return False
End If
If txtBox_cfwj3.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的与三号方位物的磁方位角!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_cfwj3.Focus()
Return False
End If
If txtBox_fwwmc3.Text.ToString.Trim.Length = 0 Then
MessageBox.Show("请填写该界桩的三号方位物名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_fwwmc3.Focus()
Return False
End If
If txtBox_fwwmc3.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请确定该界桩的三号方位物名称!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_fwwmc3.Focus()
Return False
End If
If txtBox_sm.Text.ToString.Trim.Length = 0 Or txtBox_sm.Text.ToString.Trim().Equals("请输入") Then
MessageBox.Show("请填写该界桩的备注说明!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
txtBox_sm.Focus()
Return False
End If
Return True
End If
End Function
'查询所有具体界桩信息数据
Public Function QueryAllData()
MereStoneAccess.LoadAllData(MereStoneData)
ButtonEnable("init")
End Function
'根据具体界桩编号查询具体界桩数据
Public Function QueryDataByMereStone_MapID(ByVal mapid As String)
MereStoneAccess.LoadAllDataByMapID(mapid, MereStoneData)
ButtonEnable("init")
End Function
'根据具体界桩编号查询具体界桩数据
Public Function QueryDataByMereStone_BH(ByVal code As String)
MereStoneAccess.LoadAllDataByMS_bh(code, MereStoneData)
ButtonEnable("init")
End Function
'根据具体界桩名称查询界桩数据
Public Function QueryRamusSortDataByMereStone_Name(ByVal name As String)
Return MereStoneAccess.LoadAllDataByMS_mc(name, MereStoneData)
End Function
'保存
Public Sub SaveUpdate(ByVal MereStone As MereStoneData)
MereStoneAccess.Update(MereStone)
ButtonEnable("init")
End Sub
'页面加载事件
Private Sub UCMereStoneData_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Enabled = (RowsCount = 0)
ButtonEnable("init")
End Sub
'取消按钮事件
Private Sub btn_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Cancel.Click
MereStoneData.MereStone.RejectChanges()
ButtonEnable("init")
Me.Refresh()
RaiseEvent AfterCancel()
End Sub
'保存按钮事件
Private Sub btn_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Save.Click
If Not ValidateEmpty() Then Exit Sub
Me.BindingContext(MereStoneData, MereStoneData.MereStone.TableName).EndCurrentEdit()
If MereStoneAccess.Update(MereStoneData) Then
MessageBox.Show("界桩信息保存成功!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
RaiseEvent AfterSave(New MereStone_Event(True))
ButtonEnable("init")
Else
MessageBox.Show("界桩信息保存失败!请重试!", "系统提醒!", MessageBoxButtons.OK, MessageBoxIcon.Error)
MereStoneData.MereStone.RejectChanges()
RaiseEvent AfterSave(New MereStone_Event(False))
ButtonEnable("init")
End If
End Sub
'删除按钮事件
Private Sub btn_Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Delete.Click
RaiseEvent AfterDeleteRow(New MereStone_Event)
ButtonEnable("init")
End Sub
End Class
'界桩事件参数
Public Class MereStone_Event
Inherits EventArgs
Private bool As Boolean
Private MapID As Integer
Public Property Save() As Boolean
Get
Return bool
End Get
Set(ByVal Value As Boolean)
bool = Value
End Set
End Property
Public Property MapFeatureID() As String
Get
Return MapID
End Get
Set(ByVal Value As String)
MapID = Value
End Set
End Property
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal result As Boolean)
bool = result
End Sub
Public Sub New(ByVal result As Boolean, ByVal map_id As Integer)
MapID = map_id
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -