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

📄 selectlayer.frm

📁 vb+mapx小型地图系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form selectlayer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "选择图层"
   ClientHeight    =   2355
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4170
   Icon            =   "selectlayer.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2355
   ScaleWidth      =   4170
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   3000
      TabIndex        =   2
      Top             =   1200
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   3000
      TabIndex        =   1
      Top             =   360
      Width           =   975
   End
   Begin VB.ListBox List1 
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1560
      Left            =   120
      TabIndex        =   0
      Top             =   360
      Width           =   2535
   End
End
Attribute VB_Name = "selectlayer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim liststr As String
Dim sqlstr As String

Set select_cnn = Nothing
Set select_rs = Nothing
If List1.ListIndex = -1 Then
 
 MsgBox "先选个图层"
 Else
  Dim i As Integer
Dim cnn As New ADODB.Connection

liststr = List1.List(List1.ListIndex)

cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\mapdata\my.mdb;user id=admin;" & " password=;Persist Security Info=False"

select_cnn.ConnectionString = cnnstr
select_cnn.CursorLocation = adUseClient

select_cnn.Open
If select_cnn.State = adStateOpen Then

sqlstr = "select * from " & liststr
Set select_rs = select_cnn.Execute(sqlstr)

'Dim col As Long, row As Long
'datashow.MSHFlexGrid1.row = 0
'row = 0
'For i = 0 To select_rs.Fields.Count - 1
'datashow.MSHFlexGrid1.col = i
'datashow.MSHFlexGrid1.Text = select_rs.Fields(i).Name
'Next i
'select_rs.MoveFirst
'Do While select_rs.EOF


'For i = 0 To select_rs.Fields.Count - 1
'row = row + 1
'datashow.MSHFlexGrid1.row = row
'datashow.MSHFlexGrid1.col = i
'atashow.MSHFlexGrid1.Text = select_rs.Fields(i).Value
'select_rs.MoveNext

'Next i
'Loop
 Set datashow.DataGrid1.DataSource = select_rs

datashow.DataGrid1.Refresh

datashow.Caption = liststr & "属性表"
datashow.Show

Else
MsgBox "无法打开数据源或数据源不存在"

End If
End If
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
List1.Clear

Dim layer As MapXLib.layer
For Each layer In mainform.Map1.Layers
           List1.AddItem layer.Name
           Next
           
End Sub

⌨️ 快捷键说明

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