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

📄 main.vb

📁 大型数据库系统程序球员转会系统解决方案
💻 VB
字号:

Imports System.Data
Imports System.Data.SqlClient
Imports System.IO

Public Class main
    Inherits System.Windows.Forms.Form
    Dim myconnection As SqlConnection = New _
        SqlConnection("server=(local);database=footballplayer_change;" & _
       "uid=sa;pwd=sa;")
    Dim myadapter As SqlDataAdapter = New SqlDataAdapter()
    Dim myds As DataSet
    Dim mydv As DataView
    Dim mycurrencymanager As CurrencyManager
    Public Shared tempuid As String
#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写处置以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents clubbox As System.Windows.Forms.TextBox
    Friend WithEvents coachbox As System.Windows.Forms.TextBox
    Friend WithEvents leaguebox As System.Windows.Forms.TextBox
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(main))
        Me.MainMenu1 = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuItem2 = New System.Windows.Forms.MenuItem
        Me.MenuItem3 = New System.Windows.Forms.MenuItem
        Me.MenuItem4 = New System.Windows.Forms.MenuItem
        Me.Label1 = New System.Windows.Forms.Label
        Me.clubbox = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.coachbox = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.leaguebox = New System.Windows.Forms.TextBox
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.SuspendLayout()
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2, Me.MenuItem3, Me.MenuItem4})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.Text = "俱乐部管理"
        '
        'MenuItem2
        '
        Me.MenuItem2.Index = 1
        Me.MenuItem2.Text = "转会市场"
        '
        'MenuItem3
        '
        Me.MenuItem3.Index = 2
        Me.MenuItem3.Text = "备忘录"
        '
        'MenuItem4
        '
        Me.MenuItem4.Index = 3
        Me.MenuItem4.Text = "注销"
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Location = New System.Drawing.Point(72, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(104, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "俱乐部"
        '
        'clubbox
        '
        Me.clubbox.Location = New System.Drawing.Point(224, 24)
        Me.clubbox.Name = "clubbox"
        Me.clubbox.ReadOnly = True
        Me.clubbox.Size = New System.Drawing.Size(112, 21)
        Me.clubbox.TabIndex = 1
        Me.clubbox.Text = ""
        '
        'Label2
        '
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.Location = New System.Drawing.Point(72, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(104, 24)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "教练"
        '
        'coachbox
        '
        Me.coachbox.Location = New System.Drawing.Point(224, 64)
        Me.coachbox.Name = "coachbox"
        Me.coachbox.ReadOnly = True
        Me.coachbox.Size = New System.Drawing.Size(120, 21)
        Me.coachbox.TabIndex = 3
        Me.coachbox.Text = ""
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.Location = New System.Drawing.Point(72, 112)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(112, 24)
        Me.Label3.TabIndex = 4
        Me.Label3.Text = "联赛"
        '
        'leaguebox
        '
        Me.leaguebox.Location = New System.Drawing.Point(224, 112)
        Me.leaguebox.Name = "leaguebox"
        Me.leaguebox.ReadOnly = True
        Me.leaguebox.Size = New System.Drawing.Size(120, 21)
        Me.leaguebox.TabIndex = 5
        Me.leaguebox.Text = ""
        '
        'main
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(792, 545)
        Me.Controls.Add(Me.leaguebox)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.coachbox)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.clubbox)
        Me.Controls.Add(Me.Label1)
        Me.Menu = Me.MainMenu1
        Me.Name = "main"
        Me.Text = "main"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub filldatasetandview()
        myds = New DataSet()
        Try
            myadapter.Fill(myds, "club")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        mydv = New DataView(myds.Tables("club"))
        mycurrencymanager = CType(Me.BindingContext(mydv), CurrencyManager)
    End Sub
    Private Sub bindfields()
        clubbox.DataBindings.Clear()
        coachbox.DataBindings.Clear()
        leaguebox.DataBindings.Clear()
        clubbox.DataBindings.Add("text", mydv, "name")
        ' ids.DataBindings.Clear()
        ' names.DataBindings.Add("text", mydv, "uid")
        ' ids.DataBindings.Add("text", mydv, "id")
        'statusbar1.text = "ready"
    End Sub
    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        Dim club_manage As club_manage = New club_manage()
        club_manage.Show()
    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub

    Private Sub manage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim tempset As DataSet = New DataSet()
        Dim tempadapter As SqlDataAdapter = New SqlDataAdapter()
        Dim myCommand1 As SqlCommand = New SqlCommand()
        myCommand1.CommandText = "p_uid"
        myCommand1.CommandType = CommandType.StoredProcedure
        myCommand1.Connection = myconnection
        myCommand1.Parameters.Add("@username", login.temp_username)
        tempadapter.SelectCommand = myCommand1
        myconnection.Open()
        Try
            tempadapter.SelectCommand.ExecuteNonQuery()
        Catch ex As Exception
            msgbox(ex.ToString)
        End Try
        myconnection.Close()
        tempadapter.Fill(tempset, "users")
        tempuid = tempset.Tables("users").Rows(0).Item("uid")


        Dim myCommand As SqlCommand = New SqlCommand()
        myCommand.CommandType = CommandType.StoredProcedure
        myCommand.Connection = myconnection
        myCommand.CommandText = "p_club"
        myCommand.Parameters.Add("@uid", tempuid)
        myadapter.SelectCommand = myCommand
        myconnection.Open()
        myadapter.SelectCommand.ExecuteNonQuery()
        myconnection.Close()
        filldatasetandview()
        bindfields()

    End Sub



    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        Dim market As market = New market()
        market.Show()
    End Sub

    Private Sub clubbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clubbox.TextChanged

    End Sub

    Private Sub leaguebox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles leaguebox.TextChanged

    End Sub

    Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        Dim message As message = New message()
        message.Show()
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        Me.Dispose()
        Dim login As login = New login()
        login.Show()
    End Sub
End Class

⌨️ 快捷键说明

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