【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了FrmDataGrid.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmDataGrid
BorderStyle = 1 'Fixed Single
Caption = "员工信息表"
ClientHeight = 4530
ClientLeft = 45
ClientTop = 330
ClientWidth = 8085
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4530
ScaleWidth = 8085
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出
程序"
Height = 495
Left = 4395
TabIndex = 2
Top = 3840
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "读取数据"
Height = 495
Left = 1995
TabIndex = 1
Top = 3840
Width = 1695
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 0
Top = 3720
Visible = 0 'False
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=人事.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=人事.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Pass
word = ""
RecordSource = "SELECT EmpName, Sex, Title, Salary FROM Employees ORDER BY EmpId"
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 = "FrmDataGrid.frx":0000
Height = 3375
Left = 240
TabIndex = 0
Top = 240
Width = 7695
_ExtentX = 13573
_ExtentY = 5953
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
WrapCellPointer = -1 'True
RowDividerStyle = 3
FormatLocked = -1 'True
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 = 4
BeginProperty Column00
DataField = "EmpName"
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 = "Sex"
Caption = "性别"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "Title"
Caption = "职务"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "Salary"
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
Locked = -1 'True
ColumnWidth = 1739.906
EndProperty
BeginProperty Column01
Locked = -1 'True
WrapText = -1 'True
ColumnWidth = 2009.764
EndProperty
BeginProperty Column02
ColumnWidth = 2039.811
EndProperty
BeginProperty Column03
EndProperty
EndProperty
End
End
Attribute
VB_Name = "FrmDataGrid"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'判断是否选择了表中的一行
If Adodc1.Recordset.EOF = True Or Adodc1.Recordset.BOF = True Then
MsgBox "请选择要显示的行"
Exit Sub
End If
'读取数据
FrmShowData.Text1 = Adodc1.Recordset.Fields(0)
If Adodc1.Recordset.Fields(1) <> "" Then
FrmShowData.Text2 = Adodc1.Recordset.Fields(1)
Else
FrmShowData.Text2 = ""
End If
If Adodc1.Recordset.Fields(2) <> "" Then
FrmShowData.Text3 = Adodc1.Recordset.Fields(2)
Else
FrmShowData.Text3 = ""
End If
If Adodc1.Recordset.Fields(3) <> "" Then
FrmShowData.Text4 = Adodc1.Recordset.Fie