📄 basicdata.frm
字号:
MsgBox "数据输入不完整!", vbCritical
If Text1 = "" And Text8 = "" And Text9 = "" And Text10 = "" And Text11 = "" And Text12 = "" And Text13 = "" Then
Text1.SetFocus
Else
If Text1 = "" Then
Text1.SetFocus
Else
If Text8 = "" Then
Text8.SetFocus
Else
If Text9 = "" Then
Text9.SetFocus
Else
If Text10 = "" Then
Text10.SetFocus
Else
If Text11 = "" Then
Text11.SetFocus
Else
If Text12 = "" Then
Text12.SetFocus
Else
If Text13 = "" Then
Text13.SetFocus
End If
End If
End If
End If
End If
End If
End If
End If
Exit Sub
Else
With MdbR
.AddNew
.Fields!型号 = Text1
.Fields!厂家 = Text8
.Fields!相数 = Text9
.Fields!电流 = Text10
.Fields!电压 = Text11
.Fields!精度 = Text12
.Fields!常数 = Text13
.Fields!性能 = Combo2.Text
.Update
End With
Dim itm As ListItem
Set itm = ListView2.ListItems.Add(, , CStr(Text1 & ""))
itm.SubItems(1) = Text8 & ""
itm.SubItems(2) = Text9 & ""
itm.SubItems(3) = Text10 & ""
itm.SubItems(4) = Text11 & ""
itm.SubItems(5) = Text12 & ""
itm.SubItems(6) = Text13 & ""
itm.SubItems(7) = Combo2.Text & ""
End If
End Sub
Private Sub Command7_Click()
On Error Resume Next
Set MdbR = NdMd.OpenRecordset("基本数据")
MdbR.Index = "型号"
MdbR.Seek "=", ListView2.SelectedItem
If MdbR.NoMatch Then
MsgBox ListView2.SelectedItem & "纪录未找到!", vbCritical
Else
If MsgBox("确定删除" & ListView2.SelectedItem & "档案信息吗?", vbYesNo + vbQuestion, Me.Caption) = vbYes Then
MdbR.Delete
ListView2.ListItems.Remove ListView2.SelectedItem.Index
End If
End If
End Sub
'增加目录电价数据
Private Sub Command9_Click()
On Error Resume Next
If Len(Text15) = 0 Then
MsgBox "请输入单价!", vbInformation
Text5.SetFocus
Exit Sub
End If
If Text16 = "" Then
MsgBox "请输入单价!", vbInformation
Text16.SetFocus
Exit Sub
Else
Set MdbR = NdMd.OpenRecordset("电价目录")
With MdbR
.AddNew
.Fields!LB = Text15
.Fields!nokv = Format(Val(Text16), "0.0000")
.Update
End With
Dim itm As ListItem
Set itm = ListView3.ListItems.Add(, , CStr(Text15 & ""))
itm.SubItems(1) = Format(Text16, "0.0000") & ""
Text15 = ""
Text16 = ""
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
If Screen.Width \ Screen.TwipsPerPixelX = 800 And Screen.Height \ Screen.TwipsPerPixelY = 600 Then
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 1 - 700
Else
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End If
Command6.Enabled = False
Command9.Enabled = False
Command8.Enabled = False
Combo1.AddItem "文本(*.Txt)"
Combo1.AddItem "数据库(*.Mdb)"
Combo1.AddItem "电子表格(*.Xsl)"
Combo1.AddItem "Html(*.Htm)"
Combo2.AddItem "推荐"
Combo2.AddItem "一般"
Combo2.AddItem "不推荐"
Combo2.ListIndex = 0
FileFormat = GetSetting(App.EXEName, "BankInfo", "Filemat", "")
Combo1.ListIndex = IIf(FileFormat = 0, 0, FileFormat)
Select Case Combo1.ListIndex
Case 0
FileTxt = "NDF" & Mid(Year(Date), 3, 2) & Format(Month(Date), "0#") & ".Txt"
Text7 = FileTxt
Case 1
FileExcel = "NDF" & Trim(XcName) & Mid(Year(Date), 3, 2) & Format(Month(Date), "0#") & ".xls"
Text7 = FileExcel
Case 2
FileHtml = "NDF" & Trim(XcName) & Mid(Year(Date), 3, 2) & Format(Month(Date), "0#") & ".Html"
Text7 = FileHtml
Case 3
FileAcess = "NDF" & Trim(XcName) & Mid(Year(Date), 3, 2) & Format(Month(Date), "0#") & ".Html"
Text7 = FileAcess
End Select
If GetSetting(App.EXEName, "BankInfo", "Deduck", "") = "1" Then
Option1.Value = True
Else
Option2.Value = True
End If
OpenMdb
'加载银行配置
Set MdbR = NdMd.OpenRecordset("银行配置")
Dim itm As ListItem
Dim intRecCount, intCounter As Integer
ListView1.SortKey = 0
ListView1.SortOrder = lvwAscending
ListView1.View = lvwReport
If Not MdbR.eof Then
MdbR.MoveLast
intRecCount = MdbR.RecordCount
MdbR.MoveFirst
For intCounter = 0 To MdbR.RecordCount - 1
Set itm = ListView1.ListItems.Add(, , CStr(MdbR!Bank & ""))
itm.SubItems(1) = MdbR!Cname & ""
itm.SubItems(2) = MdbR!Ip & ""
itm.SubItems(3) = MdbR!Port & ""
itm.SubItems(4) = MdbR!User & ""
itm.SubItems(5) = MdbR!Pass & ""
MdbR.MoveNext
Next intCounter
ListView1.Sorted = True
End If
'加载电价目录
Set MdbR = NdMd.OpenRecordset("电价目录")
ListView3.SortKey = 0
ListView3.SortOrder = lvwAscending
ListView3.View = lvwReport
If Not MdbR.eof Then
MdbR.MoveLast
intRecCount = MdbR.RecordCount
MdbR.MoveFirst
For intCounter = 0 To MdbR.RecordCount - 1
Set itm = ListView3.ListItems.Add(, , CStr(MdbR!LB & ""))
itm.SubItems(1) = Format(MdbR!nokv, "0.0000") & ""
itm.SubItems(2) = MdbR!Other & ""
MdbR.MoveNext
Next intCounter
ListView3.Sorted = True
End If
'加载表计数据
Set MdbR = NdMd.OpenRecordset("基本数据")
ListView2.SortKey = 0
ListView2.SortOrder = lvwAscending
ListView2.View = lvwReport
If Not MdbR.eof Then
MdbR.MoveLast
intRecCount = MdbR.RecordCount
MdbR.MoveFirst
For intCounter = 0 To MdbR.RecordCount - 1
Set itm = ListView2.ListItems.Add(, , CStr(MdbR!型号 & ""))
itm.SubItems(1) = MdbR!厂家 & ""
itm.SubItems(2) = MdbR!相数 & ""
itm.SubItems(3) = MdbR!电流 & ""
itm.SubItems(4) = MdbR!电压 & ""
itm.SubItems(5) = MdbR!精度 & ""
itm.SubItems(6) = MdbR!常数 & ""
itm.SubItems(7) = MdbR!性能 & ""
MdbR.MoveNext
Next intCounter
ListView2.Sorted = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
SaveSetting App.EXEName, "BankInfo", "Filemat", Combo1.ListIndex
NdMd.Close
End Sub
Private Sub Option1_Click()
SaveSetting App.EXEName, "BankInfo", "Deduck", "1"
Frame1.Enabled = False
Frame2.Enabled = True
Command4.Enabled = False
Command5.Enabled = False
End Sub
Private Sub Option2_Click()
Frame2.Enabled = False
Frame1.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
SaveSetting App.EXEName, "BankInfo", "Deduck", "2"
End Sub
Private Sub Text1_Change()
If Len(Trim(Text1)) <> 0 Then
Command6.Enabled = True
Else
Command6.Enabled = False
End If
End Sub
Private Sub Text1_GotFocus()
Text1.BackColor = &HFFFF00
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite
End Sub
Private Sub Text14_GotFocus()
Text14.BackColor = &HFFFF00
End Sub
Private Sub Text14_LostFocus()
Text14.BackColor = vbWhite
End Sub
Private Sub Text15_Change()
If Len(Trim(Text15)) <> 0 Then
Command9.Enabled = True
Else
Command9.Enabled = False
End If
End Sub
Private Sub Text16_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command9_Click
Text15.SetFocus
End If
End Sub
Private Sub Text8_GotFocus()
Text8.BackColor = &HFFFF00
End Sub
Private Sub Text8_LostFocus()
Text8.BackColor = vbWhite
End Sub
Private Sub Text9_GotFocus()
Text9.BackColor = &HFFFF00
End Sub
Private Sub Text9_LostFocus()
Text9.BackColor = vbWhite
End Sub
Private Sub Text10_GotFocus()
Text10.BackColor = &HFFFF00
End Sub
Private Sub Text10_LostFocus()
Text10.BackColor = vbWhite
End Sub
Private Sub Text11_GotFocus()
Text11.BackColor = &HFFFF00
End Sub
Private Sub Text11_LostFocus()
Text11.BackColor = vbWhite
End Sub
Private Sub Text12_GotFocus()
Text12.BackColor = &HFFFF00
End Sub
Private Sub Text12_LostFocus()
Text12.BackColor = vbWhite
End Sub
Private Sub Text13_GotFocus()
Text13.BackColor = &HFFFF00
End Sub
Private Sub Text13_LostFocus()
Text13.BackColor = vbWhite
End Sub
Private Sub Combo2_GotFocus()
Combo2.BackColor = &HFFFF00
End Sub
Private Sub Combo2_LostFocus()
Combo2.BackColor = vbWhite
End Sub
Private Sub Text15_GotFocus()
Text15.BackColor = &HFFFF80
End Sub
Private Sub Text15_LostFocus()
Text15.BackColor = vbWhite
End Sub
Private Sub Text16_GotFocus()
Text16.BackColor = &HFFFF80
End Sub
Private Sub Text16_LostFocus()
Text16.BackColor = vbWhite
End Sub
Private Sub Text2_GotFocus()
Text2.BackColor = &HFFFF00
End Sub
Private Sub Text2_LostFocus()
Text2.BackColor = vbWhite
End Sub
Private Sub Text3_GotFocus()
Text3.BackColor = &HFFFF00
End Sub
Private Sub Text3_LostFocus()
Text3.BackColor = vbWhite
End Sub
Private Sub Text4_GotFocus()
Text4.BackColor = &HFFFF00
End Sub
Private Sub Text4_LostFocus()
Text4.BackColor = vbWhite
End Sub
Private Sub Text5_GotFocus()
Text5.BackColor = &HFFFF00
End Sub
Private Sub Text5_LostFocus()
Text5.BackColor = vbWhite
End Sub
Private Sub Text6_GotFocus()
Text6.BackColor = &HFFFF00
End Sub
Private Sub Text6_LostFocus()
Text6.BackColor = vbWhite
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -