谁能帮我解释一下这段vb代码(详解+感谢) 20

影碟出租(frmRentDisk):OptionExplicitPublicsqlStrAsStringPublicmsgTextAsStringPublicuserNo... 影碟出租(frmRentDisk):
Option Explicit

Public sqlStr As String
Public msgText As String

Public userNo As String

Private Sub cmdOK_Click()
If verifyUser(txtMemberNo.Text) = True Then
CmdOk.Enabled = False
txtMemberNo.Enabled = False
userNo = txtMemberNo.Text
cmdRent.Enabled = True
End If
End Sub

Private Sub cmdRent_Click()
LendDisk
cmdSave.Enabled = True
End Sub

Private Sub cmdSave_Click()
saveDisks
End Sub

Private Sub cmdCancel_Click()
Unload Me

End Sub

Private Sub Form_Load()

'窗体居中显示
Me.Top = (Screen.Height - Me.Height) \ 2
Me.Left = (Screen.Width - Me.Width) \ 2

initTable
cmdRent.Enabled = False
cmdSave.Enabled = False
End Sub

Sub initTable()
Dim i As Integer

fgRent.Rows = 1

fgRent.Cols = 5

'设定行高
For i = 0 To fgRent.Rows - 1
fgRent.RowHeight(i) = 280
Next i

'设定列的属性
fgRent.Row = 0

For i = 0 To fgRent.Cols - 1
fgRent.Col = i '指定当前列为第i列
fgRent.FixedAlignment(i) = 4 '每列内容居中显示
Select Case i
Case 0
fgRent.ColWidth(i) = 600 '设定列宽
fgRent.Text = "序号"
Case 1
fgRent.ColWidth(i) = 1200 '设定列宽
fgRent.Text = "影碟编号"
Case 2
fgRent.ColWidth(i) = 2200 '设定列宽
fgRent.Text = "影碟名称"
Case 3
fgRent.ColWidth(i) = 1000 '设定列宽
fgRent.Text = "会员编号"
Case 4
fgRent.ColWidth(i) = 800 '设定列宽
fgRent.Text = "数量"
End Select

Next i
End Sub

Sub LendDisk()
Dim rs As ADODB.Recordset
Dim i As Integer
Dim j As Integer

If txtDiskNo.Text = "" Then
MsgBox "请填写影碟编号!", vbExclamation, "提示"
Exit Sub
End If
sqlStr = "select * from disks where [no]=" & txtDiskNo.Text

Set rs = ExecuteSQL(sqlStr, msgText)

If rs.RecordCount = 0 Then

MsgBox "没有查找满足条件的数据!", vbExclamation, "提示"

Else

txtDiskNo.Text = ""
lblTotal.Caption = Val(lblTotal.Caption) + 1

fgRent.Rows = fgRent.Rows + 1

fgRent.RowHeight(fgRent.Rows - 1) = 280
fgRent.Row = fgRent.Rows - 1

For j = 0 To fgRent.Cols - 1

fgRent.Col = j '设置当前为列为第j列
fgRent.CellAlignment = 4 '每列内容居中显示

Select Case j
Case 0
fgRent.Text = fgRent.Rows - 1
Case 1
fgRent.Text = rs.Fields("no")
Case 4
fgRent.Text = "1"
End Select
Next j

End If

rs.Close

End Sub
展开
 我来答
手机用户735aa
2011-11-12 · TA获得超过6.2万个赞
知道大有可为答主
回答量:3.7万
采纳率:0%
帮助的人:2731万
展开全部
一个简单的播放器吧.大概.呵呵.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式