module1.bas

来自「一个资金管理系统的成品 开发环境:VB」· BAS 代码 · 共 75 行

BAS
75
字号
Attribute VB_Name = "Module1"
Public nowconnectstring As String

Public operatetype As Integer
Public Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpAdd As String, ByVal lpFileName As String) As Boolean
Public pzhm As Variant
Public userqx As Variant
Public username As Variant
Public starttime As String
Public endtime As String

Public server As String
Public loginname As String
Public database As String
Public pass As String
Public path As String
Public wenjm As String

 
Public Sub storewjm(filename As String)
    Dim TextLine
    Dim a As Boolean
    Open App.path + "\bfwjm.txt" For Input As #1 ' 打开文件。
    Do While Not EOF(1) ' 循环至文件尾。
     Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
     If TextLine = filename Then
        Exit Sub
     End If
    Loop
    Close #1 ' 关闭文件。
    Open App.path + "\bfwjm.txt" For Append As #1 ' 打开输出文件。
    Print #1, filename ' 将备份的文件名写入文件。
    Close #1 ' 关闭文件。
End Sub
Public Sub receivewjm(listname As ListBox)
    Dim TextLine
    Open App.path + "\bfwjm.txt" For Input As #1 ' 打开文件。
    Do While Not EOF(1) ' 循环至文件尾。
     Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
     listname.AddItem TextLine  ' 在列表框中中显示数据。
    Loop
    Close #1 ' 关闭文件。
End Sub
Public Function connectstring() As String
   Dim str As String
   If Len(GetFromINI("数据库信息", "数据库", App.path + "\资金管理.ini")) = 0 Then
   Else
   connectstring = GetFromINI("数据库信息", "数据库", App.path + "\资金管理.ini")
   server = GetFromINI("数据库信息", "server", App.path + "\资金管理.ini")
   loginname = GetFromINI("数据库信息", "loginname", App.path + "\资金管理.ini")
   database = GetFromINI("数据库信息", "database", App.path + "\资金管理.ini")
   pass = GetFromINI("数据库信息", "pass", App.path + "\资金管理.ini ")
   path = GetFromINI("数据库信息", "path", App.path + "\资金管理.ini ")
   'feilu = GetFromINI("数据库信息", "feilu", App.Path + "\资金管理.ini")
   End If
End Function
Public Function GetFromINI(AppName As String, KeyName As String, filename As String) As String
   Dim RetStr As String
   RetStr = String(255, Chr(0))
   GetFromINI = Left(RetStr, GetPrivateProfileString(AppName, ByVal KeyName, "", RetStr, Len(RetStr), filename))
End Function
Public Function modiini(NewString As String, AppName As String, KeyName As String, filename As String) As Boolean
   Dim bb As Boolean
   modiini = WritePrivateProfileString(AppName, ByVal KeyName, NewString, filename)
End Function

Public Function GetDayandTime() As String
   Dim daystr As String
   Dim timestr As String
   daystr = Date
   timestr = Time
   GetDayandTime = daystr & " " & timestr
End Function

⌨️ 快捷键说明

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