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

📄 customers.vb

📁 讲解visual studio的应用
💻 VB
字号:
Public Class Customers

    Private Sub NewMenuItemMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewMenuItemMenuItem.Click
        Dim newCompanyName As String = InputBox("Please enter the new company name:")
        If newCompanyName = "" Then Return

        Dim customer As NorthwindDataSet.CustomersRow = _
                 CType(CType(CustomersBindingSource.AddNew, Data.DataRowView).Row, _
                                                     NorthwindDataSet.CustomersRow)
        customer.Company_Name = newCompanyName
        customer.Customer_ID = GenerateUniqueCustomerID(newCompanyName)

        CustomersBindingSource.AddNew()
        Dim customersEditViewDialog As MobileNorthwind.CustomersEditViewDialog = MobileNorthwind.CustomersEditViewDialog.Instance(Me.CustomersBindingSource)
        customersEditViewDialog.ShowDialog()

    End Sub

    Private Sub CustomersDataGrid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomersDataGrid.Click
        Dim customersSummaryViewDialog As MobileNorthwind.CustomersSummaryViewDialog = MobileNorthwind.CustomersSummaryViewDialog.Instance(Me.CustomersBindingSource)
        customersSummaryViewDialog.ShowDialog()

    End Sub

    Private Function GenerateUniqueCustomerID(ByVal newCompanyName As String) As String
        'This is a very rudimentary implementation and doesn't guarrantee uniqueness
        If newCompanyName = "" Then Return "@#$"
        Return newCompanyName.Substring(0, 3)
    End Function

    Private Sub CustomersSummaryViewDialog_Load(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) Handles MyBase.Load
        If NorthwindDataSetUtil.DesignerUtil.IsRunTime Then
            Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet.Customers)
            Me.OrdersTableAdapter.Fill(Me.NorthwindDataSet.Orders)
            Me.EmployeesTableAdapter.Fill(Me.NorthwindDataSet.Employees)
        End If
    End Sub

End Class

⌨️ 快捷键说明

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