📄 frmkcxx.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FRMKCXX
Caption = "库存信息"
ClientHeight = 8145
ClientLeft = 60
ClientTop = 345
ClientWidth = 10380
LinkTopic = "Form1"
Picture = "FRMKCXX.frx":0000
ScaleHeight = 8145
ScaleWidth = 10380
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Left = 3960
TabIndex = 2
Top = 7440
Width = 1575
End
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 6375
Left = 120
TabIndex = 1
Top = 600
Width = 10215
_ExtentX = 18018
_ExtentY = 11245
_Version = 393216
BackColor = 16744576
BackColorBkg = 12648447
AllowUserResizing= 3
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "库存商品信息列表"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1095
Left = 2760
TabIndex = 0
Top = 0
Width = 4575
End
End
Attribute VB_Name = "FRMKCXX"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mrc As ADODB.Recordset
Dim msgtext As String
Public txtsql As String
Private Sub Command1_Click()
Me.Hide
End Sub
Private Sub Form_Load()
ShowTitle
Dim i As Integer
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "DSN=login;uid=sa;pwd=515515;"
conn.ConnectionTimeout = 30
conn.Open
rs.Open "select * from goods", conn, adOpenStatic, adLockReadOnly, adCmdText
If rs.EOF = False Then
With msglist
.Rows = 1
Do While Not rs.EOF
.Rows = .Rows + 1
For i = 1 To rs.Fields.Count
Select Case rs.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(rs.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = rs.Fields(i - 1) & ""
End Select
Next i
rs.MoveNext
Loop
End With
End If
End Sub
Public Sub FormClose()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.Hide
End Sub
'显示Grid表头
Private Sub ShowTitle()
Dim i As Integer
With msglist
.Cols = 9
.TextMatrix(0, 1) = "编号"
.TextMatrix(0, 2) = "商品名称"
.TextMatrix(0, 3) = "计量单位"
.TextMatrix(0, 4) = "库存数量"
.TextMatrix(0, 5) = "成本价"
.TextMatrix(0, 6) = "销售单价"
.TextMatrix(0, 7) = "供应商"
.TextMatrix(0, 8) = "备注"
'固定表头
.FixedRows = 1
'设置各列的对齐方式
For i = 0 To 5
.ColAlignment(i) = 0
Next i
'表头项居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
'设置单元大小
.ColWidth(0) = 300
.ColWidth(1) = 1000
.ColWidth(2) = 2000
.ColWidth(3) = 2000
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 2000
.ColWidth(8) = 2000
.Row = 1
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -