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

📄 mdlmain.vb

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 VB
字号:
Module Module_Main

  '全局变量,存储已登录的用户信息
  Public LoginedUserInfo As New InfoProSysBusiness.UserDataModel

  '是否启用数据库连接助手,版权:http://www.trfsoft.com
  Public IsUseConnSupporter As Boolean = True


  '系统启动函数,需在项目/属性中指定
  Sub main()

    '如果程序已经运行,那么则结束以使该程序只能运行一个实例
    If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) Then
      End
    End If

    '数据库加接字符串在这里指定
    DBOpProvider.ConnSqlServer.SQLClass.ConnStr = "server=localhost; uid =sa; pwd=; database=InfoProcSystemNet" 'InfoProcSystemNet

    If IsUseConnSupporter Then
      '案例额外加入:测试数据库连接
      Dim strErrMsg As String = ""
      Dim techSupporter As New techSupport.techSupport
      If Not techSupporter.TestConn(DBOpProvider.ConnSqlServer.SQLClass.ConnStr, strErrMsg, Application.ProductName) Then
        MsgBox(strErrMsg, MsgBoxStyle.Exclamation + MsgBoxStyle.SystemModal)
        Application.Exit()
        End
      End If
    End If

    '启动登录与主窗体
    Dim frmLg As New frmLogin
    frmLg.ShowDialog()
    If frmLg.m_bLoginSuccess = True Then
      Dim frmMain As New frmMain
      Application.Run(frmMain)
    End If

  End Sub

End Module

⌨️ 快捷键说明

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