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

📄 form1.vb

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 VB
字号:
Imports System.IO
Imports System.Reflection

Public Class Form1

    Private configSettings As Dictionary(Of String, String)
    Private WithEvents tmr As Timer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        configSettings = New Dictionary(Of String, String)()

        tmr = New Timer()
        tmr.Interval = 10
        tmr.Enabled = True
    End Sub

    Private Sub tmr_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles tmr.Tick
        CType(sender, Timer).Enabled = False
        DoLogin()
    End Sub

    Private Sub DoLogin()
        ' Get the user to login
        Using frm As LoginForm = New LoginForm(configSettings)
            frm.ShowDialog()
        End Using

        ' Set connectionstring to database
        Me.MessagesTableAdapter.Connection.ConnectionString = _
                "Data Source =""" + GetApplicationDirectory() + "\AppDatabase.sdf""; password=" _
                + configSettings("DatabasePassword")

        If AppDatabaseDataSetUtil.DesignerUtil.IsRunTime() Then
            ' TODO: Delete this line of code to remove the default AutoFill for 'appDatabaseDataSet.Messages'.
            Me.messagesTableAdapter.Fill(Me.appDatabaseDataSet.Messages)
        End If
    End Sub


    Private Function GetApplicationDirectory() As String
        Return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules(0).FullyQualifiedName)
    End Function

End Class

⌨️ 快捷键说明

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