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

📄 frmdatasets.frm

📁 GIS地理信息系统开发。大名鼎鼎的MAPX+VisualBasic6.0软件开发
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmDatasets 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Add Dataset"
   ClientHeight    =   3795
   ClientLeft      =   2640
   ClientTop       =   2745
   ClientWidth     =   4905
   Icon            =   "frmDatasets.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3795
   ScaleWidth      =   4905
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton AdvancedButton 
      Caption         =   "Advanced..."
      Height          =   375
      Left            =   3600
      TabIndex        =   4
      Top             =   2600
      Width           =   1215
   End
   Begin VB.CommandButton CancelButton 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3600
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "OK"
      Default         =   -1  'True
      Enabled         =   0   'False
      Height          =   375
      Left            =   3600
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin VB.ComboBox DatabindCombo 
      Height          =   315
      ItemData        =   "frmDatasets.frx":0442
      Left            =   120
      List            =   "frmDatasets.frx":044F
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   3360
      Width           =   3255
   End
   Begin VB.ListBox DatasetList 
      Height          =   2595
      Left            =   120
      TabIndex        =   2
      Top             =   360
      Width           =   3255
   End
   Begin MSComDlg.CommonDialog dlgCommonDialog 
      Left            =   3600
      Top             =   1440
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label2 
      Caption         =   "Databinding Type:"
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   3120
      Width           =   3135
   End
   Begin VB.Label Label1 
      Caption         =   "Please pick a dataset to add:"
      Height          =   255
      Left            =   160
      TabIndex        =   3
      Top             =   120
      Width           =   2775
   End
End
Attribute VB_Name = "frmDatasets"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' This sample application and corresponding sample code is provided
' for example purposes only.  It has not undergone rigorous testing
' and as such should not be shipped as part of a final application
' without extensive testing on the part of the organization releasing
' the end-user product.

Dim MapData As Database ' This is the database "MapStats.mdb" that
                        ' is used for example themes
Dim MapDataOpen As Boolean ' This is true if MapData is an open database

Private Sub AdvancedButton_Click()
    ' The form has an "Advanced" button that allows the user to get access to
    ' advanced dataset options.  We do this by making the form larger
    ' so that these controls are revealed when the user presses the advanced
    ' button
    If AdvancedButton.Caption = "Advanced..." Then
        ' Grow the dialog, show the controls
        AdvancedButton.Caption = "Simple..."
        frmDatasets.Height = 4170
    Else
        ' Shrink the dialog, hide the controls
        AdvancedButton.Caption = "Advanced..."
        frmDatasets.Height = 3450
        
        ' Since the user does not want use of the control, set it to the
        ' default
        DatabindCombo.ListIndex = 0 ' The default is "Normal"
    End If
End Sub

Private Sub DatabindCombo_Click()
    ' When the Databinding type changes, we only want to list the datasets that are
    ' appropriate
    ' For "Normal", all datasets will work
    ' For "XY", only datasets with fields named "X" and "Y" will suffice
    ' For "Zip Code", we look for datasets that have fields whose names begin with "ZIP"
    
    ' First, remove all items from the list
    Dim i As Integer
    For i = 0 To DatasetList.ListCount - 1
        DatasetList.RemoveItem 0
    Next
    
    Dim Table As TableDef
    Dim fld As DAO.Field
    ' Then, Add all of the appropriate datasets
    Select Case DatabindCombo.ListIndex
        Case 0 ' Normal, add all the datasets
            For Each Table In MapData.TableDefs
                If Left$(Table.Name, 4) <> "MSys" Then
                    DatasetList.AddItem Table.Name
                End If
            Next
        Case 1 ' XY, look for "X" and "Y" fields
            For Each Table In MapData.TableDefs
                If Left$(Table.Name, 4) <> "MSys" Then
                    Dim HasX As Boolean
                    Dim HasY As Boolean
                    HasX = False
                    HasY = True
                    
                    For Each fld In Table.Fields
                        If fld.Name = "X" Then
                            HasX = True
                        End If
                        If fld.Name = "Y" Then
                            HasY = True
                        End If
                    Next
                    If HasX = True And HasY = True Then
                        ' The Table has both X and Y, so we can use it
                        DatasetList.AddItem Table.Name
                    End If
                End If
            Next
        Case 2 ' Zipcode, look for field that begins with "ZIP"
            For Each Table In MapData.TableDefs
                If Left$(Table.Name, 4) <> "MSys" Then
                    Dim HasZip As Boolean
                    HasZip = False
                    
                    For Each fld In Table.Fields
                        If Left$(fld.Name, 3) = "ZIP" Then
                            HasZip = True
                        End If
                    Next
                    If HasZip = True Then
                        ' The Table has the zip field, so we can use it
                        DatasetList.AddItem Table.Name
                    End If
                End If
            Next
    End Select
    
    ' Next, we should remove all of the tables that are already datasets, so
    ' we don't add them twice
    Dim ds As MapXLib.Dataset
    For Each ds In fMainForm.Map1.Datasets
        For i = 0 To DatasetList.ListCount
            If DatasetList.List(i) = ds.Name Then
                DatasetList.RemoveItem i
            End If
        Next
    Next
    
    ' Since we may have removed all of the tables, etc., we need to change
    ' the enabled status of the OK button
    If DatasetList.ListIndex = -1 Then
        OKButton.Enabled = False
    Else
        OKButton.Enabled = True
    End If
End Sub

⌨️ 快捷键说明

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