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

📄 resultsetform.vb

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

Public Class ResultSetForm

    Private ProductResultSet As MasterDetail.ProductResultSet
    Private ProductCategoryResultSet As MasterDetail.ProductCategoryResultSet

    Private Sub ResultSetForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: Delete this line of code to remove the default AutoFill for 'MasterDetail.ProductResultSet'.
        'ProductResultSet = New MasterDetail.ProductResultSet
        'ProductResultSet.Bind(Me.ProductResultSetBindingSource)
        'TODO: Delete this line of code to remove the default AutoFill for 'MasterDetail.ProductCategoryResultSet'.
        ProductCategoryResultSet = New MasterDetail.ProductCategoryResultSet
        ProductCategoryResultSet.Bind(Me.ProductCategoryResultSetBindingSource)

        SetProductResultSet()
    End Sub

    Private Sub SetProductResultSet()
        ' Find the ProductCategoryID of the selected record
        Dim prodCatID As Integer = CType((CType(Me.ProductCategoryResultSetBindingSource.Current, RowView)).UpdatableRecord("ProductCategoryID"), Integer)

        ' Create new resultset using our 'custom' constructor
        ProductResultSet = New MasterDetail.ProductResultSet(False)
        ' Filter on the index we created earlier, and only the 
        ' required ProductCategoryID
        ProductResultSet.Open("ProductCategoryID_idx", prodCatID, prodCatID)

        ' Bind the BindingSource
        ProductResultSet.Bind(Me.ProductResultSetBindingSource)
    End Sub

    Private Sub ProductCategoryResultSetDataGrid_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductCategoryResultSetDataGrid.CurrentCellChanged
        Dim oldRS As SqlCeResultSet = Me.ProductResultSet

        ' User has clicked on the grid
        SetProductResultSet()

        ' Dispose of the redundant SqlCEResultSet
        oldRS.Dispose()
    End Sub
End Class

⌨️ 快捷键说明

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