Option Explicit
Private Sub 华佗村销售系统_chkDownload_Click()'华佗村销售系统
If chkDownload.value = 1 Then
Me.Frame2.Enabled = True
Me.txtDownloadFile.BackColor = &H80000005
Me.txtDownloadToPath.BackColor = &H80000005
Me.txtDownloadBackupFiles.BackColor = &H80000005
Else
Me.Frame2.Enabled = False
Me.txtDownloadFile.BackColor = &H8000000B
Me.txtDownloadToPath.BackColor = &H8000000B
Me.txtDownloadBackupFiles.BackColor = &H8000000B
End If
End Sub
Private Sub 华佗村销售系统_chkUpload_Click()
If chkUpload.value = 1 Then
Me.Frame1.Enabled = True
Me.txtUploadFile.BackColor = &H80000005
Me.txtUploadToPath.BackColor = &H80000005
Else
Me.Frame1.Enabled = False
Me.txtUploadFile.BackColor = &H8000000B
Me.txtUploadToPath.BackColor = &H8000000B
End If
End Sub
Private Sub 华佗村销售系统_cmdCancel_Click()
Unload Me
End Sub
Private Sub 华佗村销售系统_cmdSave_Click()'华佗村销售系统
Dim lngResult As Long
Dim intCnt As Integer
Dim lngTemp As Long
Dim intTXTLen As Integer
Dim strTEMP As String
If Dir(gSettingFileName) <> "" Then Kill (gSettingFileName)'华佗村销售系统
lngResult = WritePrivateProfileString1("Setting", "IPAddress", Cipher(txtIPAddress.Text), gSettingFileName)
lngResult = WritePrivateProfileString1("Setting", "UserName", Cipher(txtUser.Text), gSettingFileName)
lngResult = WritePrivateProfileString1("Setting", "Password", Cipher(txtPassword.Text), gSettingFileName)
If chkUpload.value = 1 Then
lngResult = WritePrivateProfileString1("Setting", "Upload", "True", gSettingFileName)
Else
lngResult = WritePrivateProfileString1("Setting", "Upload", "False", gSettingFileName)
End If
lngResult = WritePrivateProfileString1("Setting", "UploadFile", txtUploadFile.Text, gSettingFileName)
intTXTLen = Len(txtUploadFile.Text)
lngTemp = 0
For intCnt = 1 To intTXTLen
If lngTemp < InStr(intCnt, txtUploadFile.Text, "\") Then lngTemp = InStr(intCnt, txtUploadFile.Text, "\")
Next intCnt
If lngTemp = 0 Then
strTEMP = ".\"
Else
strTEMP = Left(txtUploadFile.Text, lngTemp)
End If
lngResult = WritePrivateProfileString1("Setting", "UploadFromPath", strTEMP, gSettingFileName)
lngResult = WritePrivateProfileString1("Setting", "UploadToPath", txtUploadToPath.Text, gSettingFileName)
If chkDelAfterUpload.value = 1 Then'华佗村销售系统
lngResult = WritePrivateProfileString1("Setting", "UploadAfterDel", "True", gSettingFileName)
Else
lngResult = WritePrivateProfileString1("Setting", "UploadAfterDel", "False", gSettingFileName)
End If
If chkDownload.value = 1 Then
lngResult = WritePrivateProfileString1("Setting", "Download", "True", gSettingFileName)
Else
lngResult = WritePrivateProfileString1("Setting", "Download", "False", gSettingFileName)
End If
If chkDownloadCondition.value = 1 Then
lngResult = WritePrivateProfileString1("Setting", "DownloadCondition", "True", gSettingFileName)
Else
lngResult = WritePrivateProfileString1("Setting", "DownloadCondition", "False", gSettingFileName)
End If
lngResult = WritePrivateProfileString1("Setting", "DownloadFile", txtDownloadFile.Text, gSettingFileName)
intTXTLen = Len(txtDownloadFile.Text)
lngTemp = 0
For intCnt = 1 To intTXTLen'华佗村销售系统
If lngTemp < InStr(intCnt, txtDownloadFile.Text, "\") Then lngTemp = InStr(intCnt, txtDownloadFile.Text, "\")
If lngTemp < InStr(intCnt, txtDownloadFile.Text, "/") Then lngTemp = InStr(intCnt, txtDownloadFile.Text, "/")
Next intCnt
strTEMP = Left(txtDownloadFile.Text, lngTemp)
lngResult = WritePrivateProfileString1("Setting", "DownloadFromPath", strTEMP, gSettingFileName)
lngResult = WritePrivateProfileString1("Setting", "DownloadToPath", txtDownloadToPath.Text, gSettingFileName)
lngResult = WritePrivateProfileString1("Setting", "DownloadBackupFiles", txtDownloadBackupFiles.Text, gSettingFileName)
Call LoadSetting_Value
frmFTP.cmdTransfer.Enabled = False
If txtIPAddress.Text <> "" And txtUser.Text <> "" Then
If chkUpload.value = 1 Or chkDownload.value = 1 Then
frmFTP.cmdTransfer.Enabled = True
End If
End If
Unload Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) '华佗村销售系统
If TypeOf ActiveControl Is TextBox And KeyAscii = vbKeyReturn Then SendKeys "{TAB}"
If TypeOf ActiveControl Is ComboBox And KeyAscii = vbKeyReturn Then SendKeys "{TAB}"
'If TypeOf ActiveControl Is MaskEdBox And KeyAscii = vbKeyReturn Then SendKeys "{TAB}"
End Sub
Private Sub Form_Load() '华佗村销售系统
chkUpload.value = 1
chkDownload.value = 1
txtIPAddress.Text = ""
txtUser.Text = ""
txtPassword.Text = ""
chkUpload.value = IIf(gUpload, 1, 0)
txtUploadFile.Text = gUploadFile
txtUploadToPath.Text = gUploadToPath
chkDownload.value = IIf(gDownload, 1, 0)
chkDownloadCondition.value = IIf(gDownloadCondition, 1, 0)
txtDownloadFile.Text = gDownloadFile
txtDownloadToPath.Text = gDownloadToPath
txtDownloadBackupFiles.Text = gDownloadBackupFiles
End Sub
Private Sub txtDownloadBackupFiles_LostFocus() '华佗村销售系统
txtDownloadBackupFiles.Text = Trim(txtDownloadBackupFiles.Text)
End Sub
Private Sub txtDownloadFile_LostFocus() '华佗村销售系统
txtDownloadFile.Text = Trim(txtDownloadFile.Text)
End Sub
Private Sub txtDownloadToPath_LostFocus() '华佗村销售系统
txtDownloadToPath.Text = Trim(txtDownloadToPath.Text)
If txtDownloadToPath.Text = "" Then
txtDownloadToPath.Text = ".\"
ElseIf Right(txtDownloadToPath.Text, 1) <> "\" Then
txtDownloadToPath.Text = txtDownloadToPath.Text & "\"
End If
End Sub
Private Sub txtIPAddress_LostFocus() '华佗村销售系统
Dim intCondition As Integer
txtIPAddress.Text = Trim(txtIPAddress.Text)
intCondition = InStr(txtIPAddress.Text, " ")
Do Until intCondition = 0
txtIPAddress.Text = Left(txtIPAddress.Text, intCondition - 1) & Mid(txtIPAddress, intCondition + 1)
txtIPAddress.Text = Trim(txtIPAddress.Text)
intCondition = InStr(txtIPAddress.Text, " ")
Loop
End Sub
Private Sub txtPassword_LostFocus() '华佗村销售系统
txtPassword.Text = Trim(txtPassword.Text)
End Sub
Private Sub txtUploadToPath_LostFocus() '»华佗村销售系统
txtUploadToPath = Trim(txtUploadToPath)
End Sub
Private Sub txtUser_LostFocus() '华佗村销售系统
txtUser.Text = Trim(txtUser)
End Sub
来源:CSDN
作者:john_dwh
链接:https://blog.csdn.net/john_dwh/article/details/103934536