⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_fzgj_addresslist.frm

📁 商品进销存管理系统 采用VB和SQL2000开发 具有很强的实用性
💻 FRM
📖 第 1 页 / 共 3 页
字号:
    txtOffice.text = ""
    txtCompanyName.text = ""
    txtCompanyNet.text = "http://"
    Call txtUnLock

    cmdAdd.Enabled = False
    cmdUpdata.Enabled = False
    cmdDel.Enabled = False
    cmdSave.Enabled = True
    cmdCancel.Enabled = True
    txtName.SetFocus
    Adodc1.Recordset.AddNew
End Sub

Private Sub cmdCancel_Click()

    Adodc1.Recordset.CancelBatch
    txtName.text = ""
    txtSex.text = ""
    txtEmail.text = ""
    txtPhone.text = ""
    txtMobile.text = ""
    txtPersonNet.text = ""
    txtOperation.text = ""
    txtFax.text = ""
    txtDuty.text = ""
    txtDept.text = ""
    txtOffice.text = ""
    txtCompanyName.text = ""
    txtCompanyNet.text = ""

    cmdSave.Enabled = False
    cmdCancel.Enabled = False
    cmdUpdata.Enabled = False
    cmdDel.Enabled = False
    cmdAdd.Enabled = True
    Call txtLock
End Sub

Private Sub cmdDel_Click()
    If MsgBox("确定要删除当前记录吗?", vbOKCancel + vbQuestion, "提示") = vbOK Then
        Adodc1.Recordset.Delete
    End If
End Sub

Private Sub CmdEnd_Click()
    Unload Me
End Sub

Private Sub cmdFind_Click()
    Adodc1.RecordSource = "select * from tb_addressl where 姓名 like '" & txtFind.text & "%'"
    Adodc1.Refresh
End Sub

Private Sub cmdSave_Click()
    If txtName = "" Then
        MsgBox "姓名不能为空!", vbOKOnly + vbInformation, "提示"
        txtName.SetFocus
        Exit Sub
    End If
    Adodc1.Recordset.Fields(1).Value = txtName.text
    Adodc1.Recordset.Fields(2).Value = txtSex.text
    Adodc1.Recordset.Fields(3).Value = txtEmail.text
    Adodc1.Recordset.Fields(4).Value = txtPhone.text
    Adodc1.Recordset.Fields(5).Value = txtMobile.text
    Adodc1.Recordset.Fields(6).Value = txtPersonNet.text
    Adodc1.Recordset.Fields(7).Value = txtOperation.text
    Adodc1.Recordset.Fields(8).Value = txtFax.text
    Adodc1.Recordset.Fields(9).Value = txtDuty.text
    Adodc1.Recordset.Fields(10).Value = txtDept.text
    Adodc1.Recordset.Fields(11).Value = txtOffice.text
    Adodc1.Recordset.Fields(12).Value = txtCompanyName.text
    Adodc1.Recordset.Fields(13).Value = txtCompanyNet.text
    Adodc1.Recordset.Update
    Adodc1.Refresh
    Adodc1.RecordSource = "select * from tb_addressl"
    Adodc1.Refresh

    cmdSave.Enabled = False
    cmdCancel.Enabled = False
    cmdUpdata.Enabled = False
    cmdDel.Enabled = False
    cmdAdd.Enabled = True
    cmdAdd.SetFocus
    Call txtLock
End Sub

Private Sub cmdUpdata_Click()
    cmdAdd.Enabled = False
    cmdDel.Enabled = False
    cmdSave.Enabled = True
    cmdCancel.Enabled = True
    Call txtUnLock
End Sub

Private Sub cmdURL_Click()
    If txtPersonNet <> "" Then
        ShellExecute Me.hwnd, "open", txtPersonNet.text, 1, 1, 5
    End If
End Sub

Private Sub cmdURL2_Click()
    If txtCompanyNet.text <> "" Then
        ShellExecute Me.hwnd, "open", txtCompanyNet.text, 1, 1, 5
    End If
End Sub

Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        PopupMenu OP
    ElseIf Button = 1 Then
        cmdDel.Enabled = True
        cmdUpdata.Enabled = True
    End If
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    txtName.text = DataGrid1.Columns.Item(1).text
    txtSex.text = DataGrid1.Columns.Item(2).text
    txtEmail.text = DataGrid1.Columns.Item(3).text
    txtPhone.text = DataGrid1.Columns.Item(4).text
    txtMobile.text = DataGrid1.Columns.Item(5).text
    txtPersonNet.text = DataGrid1.Columns.Item(6).text
    txtOperation.text = DataGrid1.Columns.Item(7).text
    txtFax.text = DataGrid1.Columns.Item(8).text
    txtDuty.text = DataGrid1.Columns.Item(9).text
    txtDept.text = DataGrid1.Columns.Item(10).text
    txtOffice.text = DataGrid1.Columns.Item(11).text
    txtCompanyName.text = DataGrid1.Columns.Item(12).text
    txtCompanyNet.text = DataGrid1.Columns.Item(13).text
    If txtName = "" Then
        txtCompanyNet.text = "http://"
        txtPersonNet.text = "http://"
    End If
End Sub
Private Sub Del_Click()
    cmdDel.Enabled = True
    cmdUpdata.Enabled = False
    cmdAdd.Enabled = False
    cmdCancel.Enabled = True
    cmdSave.Enabled = True
End Sub
Private Sub Form_Load()
    Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_JXC;Data Source=."
    Adodc1.RecordSource = "select * from tb_addressl"
    Adodc1.Refresh
    Set DataGrid1.DataSource = Adodc1
    cmdSave.Enabled = False
    cmdCancel.Enabled = False
    cmdUpdata.Enabled = False
    cmdDel.Enabled = False
    cmdAdd.Enabled = True
    Call txtLock
End Sub

Private Sub txtCompanyName_GotFocus()
    txtCompanyName.BackColor = &HFFC0FF
End Sub

Private Sub txtCompanyName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtCompanyName_LostFocus()
  txtCompanyName.BackColor = &H80000018
End Sub

Private Sub txtCompanyNet_GotFocus()
  txtCompanyNet.BackColor = &HFFC0FF
End Sub

Private Sub txtCompanyNet_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtCompanyNet_LostFocus()
  txtCompanyNet.BackColor = &H80000018
End Sub

Private Sub txtDept_GotFocus()
  txtDept.BackColor = &HFFC0FF
End Sub

Private Sub txtDept_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtDept_LostFocus()
  txtDept.BackColor = &H80000018
End Sub

Private Sub txtDuty_GotFocus()
  txtDuty.BackColor = &HFFC0FF
End Sub

Private Sub txtDuty_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtDuty_LostFocus()
  txtDuty.BackColor = &H80000018
End Sub

Private Sub txtEmail_GotFocus()
  txtEmail.BackColor = &HFFC0FF
End Sub

Private Sub txtEmail_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtEmail_LostFocus()
  txtEmail.BackColor = &H80000018
End Sub

Private Sub txtFax_GotFocus()
  txtFax.BackColor = &HFFC0FF
End Sub

Private Sub txtFax_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtFax_LostFocus()
  txtFax.BackColor = &H80000018
End Sub

Private Sub txtMobile_GotFocus()
  txtMobile.BackColor = &HFFC0FF
End Sub

Private Sub txtMobile_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtMobile_LostFocus()
  txtMobile.BackColor = &H80000018
End Sub

Private Sub txtName_GotFocus()
  txtName.BackColor = &HFFC0FF
End Sub

Private Sub txtName_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtName_LostFocus()
  txtName.BackColor = &H80000018
End Sub

Private Sub txtOffice_GotFocus()
  txtOffice.BackColor = &HFFC0FF
End Sub

Private Sub txtOffice_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtOffice_LostFocus()
  txtOffice.BackColor = &H80000018
End Sub

Private Sub txtOperation_GotFocus()
  txtOperation.BackColor = &HFFC0FF
End Sub

Private Sub txtOperation_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtOperation_LostFocus()
  txtOperation.BackColor = &H80000018
End Sub

Private Sub txtPersonNet_GotFocus()
    txtPersonNet.BackColor = &HFFC0FF
End Sub

Private Sub txtPersonNet_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtPersonNet_LostFocus()
    txtPersonNet.BackColor = &H80000018
End Sub

Private Sub txtPhone_GotFocus()
    txtPhone.BackColor = &HFFC0FF
End Sub

Private Sub txtPhone_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtPhone_LostFocus()
    txtPhone.BackColor = &H80000018
End Sub

Private Sub txtSex_GotFocus()
    txtSex.BackColor = &HFFC0FF
End Sub

Private Sub txtSex_KeyPress(KeyAscii As Integer)
     If KeyAscii = 13 Then SendKeys "{TAB}", True
End Sub

Private Sub txtSex_LostFocus()
    txtSex.BackColor = &H80000018
End Sub

Private Sub Updata_Click()
    cmdUpdata.Enabled = True
    cmdDel.Enabled = False
    cmdAdd.Enabled = False
    cmdCancel.Enabled = True
    cmdSave.Enabled = True
End Sub

Sub txtLock()
    txtName.Enabled = False
    txtSex.Enabled = False
    txtEmail.Enabled = False
    txtPhone.Enabled = False
    txtMobile.Enabled = False
    txtPersonNet.Enabled = False
    txtOperation.Enabled = False
    txtFax.Enabled = False
    txtDuty.Enabled = False
    txtDept.Enabled = False
    txtOffice.Enabled = False
    txtCompanyName.Enabled = False
    txtCompanyNet.Enabled = False
End Sub

Sub txtUnLock()

    txtName.Enabled = True
    txtSex.Enabled = True
    txtEmail.Enabled = True
    txtPhone.Enabled = True
    txtMobile.Enabled = True
    txtPersonNet.Enabled = True
    txtOperation.Enabled = True
    txtFax.Enabled = True
    txtDuty.Enabled = True
    txtDept.Enabled = True
    txtOffice.Enabled = True
    txtCompanyName.Enabled = True
    txtCompanyNet.Enabled = True

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -