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

📄 selectview.frm

📁 一个商业软件的源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
Frame7.Visible = True
For i = 0 To Adodc1.Recordset.Fields.Count - 1
Text1.Text = Text1.Text & Adodc1.Recordset.Fields(i).name & ":" & Adodc1.Recordset.Fields(i).Value & Chr(13) + Chr(10)
Next i
End If
Else
Frame7.Visible = False
End If
End Sub

Private Sub DataGrid1_DragDrop(Source As Control, X As Single, Y As Single)
Frame7.Left = X
Frame7.Top = Y
End Sub

Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
cols = ColIndex
coln = DataGrid1.Columns(ColIndex).Caption
End Sub

Private Sub Form_Load()

Adodc1.ConnectionString = cnnado.ConnectionString
Adodc1.RecordSource = sq
Set DataGrid1.DataSource = Adodc1

DataGrid1.Top = 100
DataGrid1.Left = 500
DataGrid1.Width = Me.ScaleWidth - 1000
DataGrid1.Height = Me.ScaleHeight - StatusBar1.Height - 100
End Sub

Private Sub Form_Resize()
DataGrid1.Top = 100
DataGrid1.Left = 500
DataGrid1.Width = Me.ScaleWidth - 1000
DataGrid1.Height = Me.ScaleHeight - StatusBar1.Height - 100
End Sub

Private Sub Form_Unload(Cancel As Integer)
YM = False

End Sub

Private Sub Label2_Click()
Frame7.Visible = False
End Sub

Private Sub mnuPreview_Click()

If YM = True Then
prtfg1.设置标题 = a(0) '设置报表标题
prtfg1.设置副标题 = a(1)
prtfg1.设置表格名 = a(2)
prtfg1.设置表左脚 = a(3)
prtfg1.设置表右脚 = a(4)
Else
prtfg1.设置标题 = "" '设置报表标题
prtfg1.设置副标题 = ""
prtfg1.设置表格名 = "部门:cad"
prtfg1.设置表左脚 = "制表人" & user
prtfg1.设置表右脚 = VBA.Date
prtfg1.上边距 = 5   '设置边距,单位毫米
prtfg1.下边距 = 5
prtfg1.左边距 = 5
prtfg1.右边距 = 5
End If
prtfg1.SetDT = False  '设置双表头为假
prtfg1.AutoAlign = False '自动右对齐关闭
prtfg1.横向打印 = False '是否横向打印?
prtfg1.默认纸张 = 9  '设置默认纸张  9为A

prtfg1.打印 DataGrid1  '打印DataGrid1

End Sub

Private Sub mnuPrint_Click()

End Sub

Private Sub mundggx_Click()
If mundggx.Checked = True Then
mundggx.Checked = False
DataGrid1.AllowUpdate = False
Else
mundggx.Checked = True
DataGrid1.AllowUpdate = True
End If
End Sub

Private Sub MUNEXCEL_Click()
Dim i     As Integer
Dim J     As Integer

If Adodc1.Recordset.RecordCount <> 0 Then
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

For J = 0 To DataGrid1.Columns.Count - 1
xlSheet.Cells(1, J + 1) = DataGrid1.Columns.Item(J).Caption
Next J
Adodc1.Recordset.MoveFirst

For i = 0 To Adodc1.Recordset.RecordCount - 1 Step 1
   
For J = 0 To Adodc1.Recordset.Fields.Count - 1 Step 1
  
  
     If IsNull(Adodc1.Recordset.Fields(J).Value) = False Then
         xlSheet.Cells(i + 2, J + 1) = Adodc1.Recordset.Fields(J).Value   ' //dtg1是datagrid控件的名称
    End If

Next J
Adodc1.Recordset.MoveNext
Next i
End If
End Sub

Private Sub munth_Click()
Dim i As Integer
Dim s As String
i = DataGrid1.Col
s = DataGrid1.Text
Dim sk As String

If Adodc1.Recordset.RecordCount <> 0 Then
sk = InputBox("您要将[" & s & "]替换为?", "替换")
 If MsgBox("您确定要替换吗?", vbYesNo, "替换") = vbYes Then
DataGrid1.AllowUpdate = True
Adodc1.Recordset.MoveFirst
 
 Do While Not Adodc1.Recordset.EOF

If DataGrid1.Columns(i).Text = s Then

DataGrid1.Columns(i).Text = sk
Else
Adodc1.Recordset.MoveNext
End If
Loop
Else
Exit Sub
End If
Adodc1.Recordset.MoveFirst
End If
DataGrid1.AllowUpdate = False



End Sub

Private Sub muntz_Click()


If InputBox("请输入管理员密码", "验证") = USEPASSWORD Then

Dim ss As String
Dim sss As String
Dim lx As String
If Adodc1.Recordset.RecordCount <> 0 Then
If coln <> "" Then
lx = ConvType(Adodc1.Recordset.Fields(cols).Type)
ss = InputBox("请输入" & lx & "类型的填充内容", "批量填充")

 If ss = "" Then
 sss = "暂无"
 Else
 sss = ss
 End If
 If MsgBox("您确定要批量填充", vbYesNo, "批量填充") = vbYes Then
Do While Not Adodc1.Recordset.EOF
If DataGrid1.Columns(cols).Text = "" Then
DataGrid1.Columns(cols).Text = sss
Else
Adodc1.Recordset.MoveNext
End If
Loop
Else
Exit Sub
End If
Adodc1.Recordset.MoveFirst
End If
End If
Else
Exit Sub
End If
End Sub

Private Sub munymsz_Click()
Form12.Show
End Sub
Private Function ConvType(ByVal TypeVal As Long) As String
  Select Case TypeVal
        Case adBigInt                    ' 20
            ConvType = "长整数"
        Case adBinary                    ' 128
            ConvType = "Binary"
        Case adBoolean                   ' 11
            ConvType = "布尔"
        Case adBSTR                      ' 8 i.e. null terminated string
            ConvType = "文本"
        Case adChar                      ' 129
            ConvType = "文本"
        Case adCurrency                  ' 6
            ConvType = "货币"
        Case adDate                      ' 7
            ConvType = "时间日期"
        Case adDBDate                    ' 133
            ConvType = "时间日期"
        Case adDBTime                    ' 134
            ConvType = "时间日期"
        Case adDBTimeStamp               ' 135
            ConvType = "时间日期"
        Case adDecimal                   ' 14
            ConvType = "Float"
        Case adDouble                    ' 5
            ConvType = "Float"
        Case adEmpty                     ' 0
            ConvType = "空"
        Case adError                     ' 10
            ConvType = "Error"
        Case adGUID                      ' 72
            ConvType = "GUID"
        Case adIDispatch                 ' 9
            ConvType = "IDispatch"
        Case adInteger                   ' 3
            ConvType = "整数"
        Case adIUnknown                  ' 13
            ConvType = "Unknown"
        Case adLongVarBinary             ' 205
            ConvType = "Binary"
        Case adLongVarChar               ' 201
            ConvType = "文本"
        Case adLongVarWChar              ' 203
            ConvType = "文本"
        Case adNumeric                  ' 131
            ConvType = "整数"
        Case adSingle                    ' 4
            ConvType = "单精度数"
        Case adSmallInt                  ' 2
            ConvType = "短整数"
        Case adTinyInt                   ' 16
            ConvType = "Tiny Integer"
        Case adUnsignedBigInt            ' 21
            ConvType = "Big Integer"
        Case adUnsignedInt               ' 19
            ConvType = "Integer"
        Case adUnsignedSmallInt          ' 18
            ConvType = "Small Integer"
        Case adUnsignedTinyInt           ' 17
            ConvType = "Timy Integer"
        Case adUserDefined               ' 132
            ConvType = "UserDefined"
        Case adVarNumeric                 ' 139
            ConvType = "Long"
        Case adVarBinary                 ' 204
            ConvType = "Binary"
        Case adVarChar                   ' 200
            ConvType = "文本"
        Case adVariant                   ' 12
            ConvType = "Variant"
        Case adVarWChar                  ' 202
            ConvType = "文本"
        Case adWChar                     ' 130
            ConvType = "文本"
        Case Else
            ConvType = "Unknown"
   End Select
End Function

Private Sub munzk_Click()
If munzk.Checked = True Then
munzk.Checked = False
Frame7.Visible = False
Else
munzk.Checked = True
Frame7.Visible = True
End If
End Sub

Private Sub Text1_Change()

End Sub

Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
Frame7.Left = X + Frame7.Left
Frame7.Top = Y + Frame7.Top
End Sub

⌨️ 快捷键说明

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