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

📄 addprojectform.vb

📁 使用Access数据库演示的任务分配管理程序 一个使用ADO.NET基于Microsoft Access数据库演示的任务分配管理的程序
💻 VB
字号:
'---------------------------------------------------------------------
'  This file is part of the Microsoft .NET Framework SDK Code Samples.
' 
'  Copyright (C) Microsoft Corporation.  All rights reserved.
' 
' This source code is intended only as a supplement to Microsoft
' Development Tools and/or on-line documentation.  See these other
' materials for detailed information regarding Microsoft code samples.
' 
' THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.
'---------------------------------------------------------------------

Public Class AddProjectForm


    Public Sub New(ByVal dl As DataLayer)
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        m_DataLayer = dl
    End Sub

    Private m_DataLayer As DataLayer
    Private m_ResourceManager As New Resources.ResourceManager("TeamVision.Localize", System.Reflection.Assembly.GetExecutingAssembly())

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If txtProjectName.Text.Trim() <> String.Empty Then

            Dim projectID As Integer = -1
            Dim project As New Business.Project
            Dim facade As New Database.ProjectFacade

            'if database update was successful add the project to our local data
            With project
                .ProjectID = projectID
                .Name = txtProjectName.Text.Trim()
                .Description = txtDescription.Text.Trim()
                .DateCreated = DateTime.Now
            End With
            project.ProjectID = facade.InsertProject(project)

            If (project.ProjectID > 0) Then
                Me.DialogResult = Windows.Forms.DialogResult.OK
            Else
                MessageBox.Show(m_ResourceManager.GetString("Unable_to_add_project"))
                Me.DialogResult = System.Windows.Forms.DialogResult.None
            End If
        Else
            Me.DialogResult = System.Windows.Forms.DialogResult.None
        End If
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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