📄 frmmodify.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Begin VB.Form FrmModify
Caption = "FrmModify"
ClientHeight = 8850
ClientLeft = 60
ClientTop = 450
ClientWidth = 10545
LinkTopic = "Form1"
ScaleHeight = 8850
ScaleWidth = 10545
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox CobSelType
Height = 300
Left = 7680
TabIndex = 6
Top = 720
Width = 1935
End
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 495
Left = 8880
TabIndex = 5
Top = 7800
Width = 1215
End
Begin VB.CommandButton CmdSave
Caption = "保存修改"
Height = 495
Left = 7260
TabIndex = 4
Top = 7800
Width = 1215
End
Begin VB.CommandButton CmdCorrect
Caption = "修改数据"
Height = 495
Left = 5640
TabIndex = 3
Top = 7800
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 690
Left = 960
Top = 7680
Width = 3495
_ExtentX = 6165
_ExtentY = 1217
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmModify.frx":0000
Height = 4935
Left = 600
TabIndex = 2
Top = 1800
Width = 9495
_ExtentX = 16748
_ExtentY = 8705
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label2
Caption = "选择数据:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 5520
TabIndex = 1
Top = 720
Width = 1455
End
Begin VB.Label Label1
Height = 615
Left = 1920
TabIndex = 0
Top = 720
Width = 2775
End
End
Attribute VB_Name = "FrmModify"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cboSelType_Click()
Dim strSql As String
Screen.MousePointer = vbHourglass
Adodc1.Recordset.Update
strSql = "select * from " & cboSelType.Text
Adodc1.RecordSource = strSql
Adodc1.Caption = cboSelType.Text
Adodc1.Refresh
Screen.MousePointer = vbArrow
Call FmtSetting
DataGrid1.Refresh
DataGrid1.AllowUpdate = True
End Sub
Private Sub Command3_Click()
FrmModify.Adodc1.Recordset.Update
Unload Me
End Sub
Private Sub CmdCorrect_Click()
DataGrid1.AllowUpdate = True
End Sub
Private Sub CmdSave_Click()
Adodc1.Recordset.Update
End Sub
Private Sub Form_Load()
Dim I As Integer
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
FrmModify.cboSelType.Clear
Select Case g_ModifyType
Case 1
Label1.Caption = "观测数据表"
FrmModify.cboSelType.AddItem "基本信息表"
FrmModify.cboSelType.AddItem "点名表"
FrmModify.cboSelType.AddItem "观测数据表"
Case 2
Label1.Caption = "成果表"
FrmModify.cboSelType.AddItem "1成果表"
FrmModify.cboSelType.AddItem "2成果表"
CmdCorrect.Visible = False
CmdSave.Visible = False
CmdCorrect.Enabled = False
CmdSave.Enabled = False
End Select
cboSelType.Text = cboSelType.List(0)
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & g_ProjectFile & ";Mode=Read|Write"
Adodc1.Caption = cboSelType.Text
Adodc1.RecordSource = "select * from " & cboSelType.Text
Adodc1.Refresh
Call FmtSetting
DataGrid1.Refresh
End Sub
Sub FmtSetting()
Dim I As Integer
Dim idx As Integer
Dim Fmt As New StdDataFormat
Dim Fmt1 As New StdDataFormat
Fmt.Format = "0.0000"
Fmt1.Format = "0.00"
idx = cboSelType.ListIndex
If idx < 0 Then idx = 0
Select Case g_ModifyType
Case 1
Select Case idx
Case 0
For I = 0 To 15
DataGrid1.Columns(I).Alignment = dbgCenter
Next I
For I = 14 To 15
Set DataGrid1.Columns(I).DataFormat = Fmt1
Next I
Case 1
For I = 0 To 1
DataGrid1.Columns(I).Alignment = dbgCenter
Next I
DataGrid1.Columns(2).Alignment = dbgRight
Set DataGrid1.Columns(2).DataFormat = Fmt
Case 2
For I = 0 To 2
DataGrid1.Columns(I).Alignment = dbgCenter
Next I
For I = 3 To 4
DataGrid1.Columns(I).Alignment = dbgRight
Next I
Set DataGrid1.Columns(3).DataFormat = Fmt
Set DataGrid1.Columns(4).DataFormat = Fmt1
End Select
Case 2
Select Case idx
Case 0
For I = 0 To 1
DataGrid1.Columns(I).Alignment = dbgCenter
Next I
DataGrid1.Columns(2).Alignment = dbgRight
Set DataGrid1.Columns(2).DataFormat = Fmt
DataGrid1.Columns(3).Alignment = dbgRight
Set DataGrid1.Columns(3).DataFormat = Fmt1
Case 1
For I = 0 To 2
DataGrid1.Columns(I).Alignment = dbgCenter
Next I
For I = 3 To 8
DataGrid1.Columns(I).Alignment = dbgRight
Next I
Set DataGrid1.Columns(3).DataFormat = Fmt
Set DataGrid1.Columns(4).DataFormat = Fmt1
Set DataGrid1.Columns(5).DataFormat = Fmt
Set DataGrid1.Columns(6).DataFormat = Fmt1
Set DataGrid1.Columns(7).DataFormat = Fmt1
Set DataGrid1.Columns(8).DataFormat = Fmt1
End Select
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -