求助vb代码意思
PublicstrDZIdAsStringPrivateSubCommand1_Click()''入库OnErrorGoToErrDimrstAsNewADODB.Rec...
Public strDZId As String
Private Sub Command1_Click() ''入库
On Error GoTo Err
Dim rst As New ADODB.Recordset
Dim i As Integer
For i = 0 To 9
If i <> 5 And i<> 6 Then
If Trim(Text1(i).Text)= "" Then
MsgBoxLabel1(i).Caption & "不能为空!", , "提示"
Text1(i).SetFocus
Exit Sub
End If
End If
Next i
Dim j As Integer
If rst.State Then rst.Close
rst.Open "select * from 进货入库信息 where 入库单号='" & Trim(Text1(0).Text) & "'", CN,adOpenStatic, adLockOptimistic
If Trim(strDZId) = "" Then '添加
rst.AddNew
For i = 0 To 10
IfTrim(Text1(i).Text) <> "" Then rst.Fields(i).Value =Trim(Text1(i).Text)
Next i
rst.Update
With Form7.MSHFlexGrid1
If .Rows = 2 AndTrim(.TextMatrix(1, 1)) = "" Then
Else
.Rows = .Rows+ 1
For i = .Rows- 2 To 1 Step -1
For j = 0To 10
.TextMatrix(i + 1, j) = .TextMatrix(i, j)
Next j
Next i
End If
For i = 0 To 10
IfTrim(Text1(i).Text) <> "" Then .TextMatrix(1, i) =Trim(Text1(i).Text)
Next i
End With 展开
Private Sub Command1_Click() ''入库
On Error GoTo Err
Dim rst As New ADODB.Recordset
Dim i As Integer
For i = 0 To 9
If i <> 5 And i<> 6 Then
If Trim(Text1(i).Text)= "" Then
MsgBoxLabel1(i).Caption & "不能为空!", , "提示"
Text1(i).SetFocus
Exit Sub
End If
End If
Next i
Dim j As Integer
If rst.State Then rst.Close
rst.Open "select * from 进货入库信息 where 入库单号='" & Trim(Text1(0).Text) & "'", CN,adOpenStatic, adLockOptimistic
If Trim(strDZId) = "" Then '添加
rst.AddNew
For i = 0 To 10
IfTrim(Text1(i).Text) <> "" Then rst.Fields(i).Value =Trim(Text1(i).Text)
Next i
rst.Update
With Form7.MSHFlexGrid1
If .Rows = 2 AndTrim(.TextMatrix(1, 1)) = "" Then
Else
.Rows = .Rows+ 1
For i = .Rows- 2 To 1 Step -1
For j = 0To 10
.TextMatrix(i + 1, j) = .TextMatrix(i, j)
Next j
Next i
End If
For i = 0 To 10
IfTrim(Text1(i).Text) <> "" Then .TextMatrix(1, i) =Trim(Text1(i).Text)
Next i
End With 展开
2个回答
展开全部
他这个用了With语句,With块内的直接按‘.’,那么前面的就表示With语句那个变量,实际给你翻译一下。
Private Sub InitList1()
Me.ListView1.ColumnHeaders .Add( , , "车位编号", 1000 )
Me.ListView1.ColumnHeaders .Add(, , "住户名称", 1600 )
Me.ListView1.ColumnHeaders .Add(, , "使用日期", 1600 )
Me.ListView1.ColumnHeaders .Add(, , "备注", 3000 )
他这些东西是在传参数,加上括号这么看就清楚了。
End Sub
Private Sub InitList1()
Me.ListView1.ColumnHeaders .Add( , , "车位编号", 1000 )
Me.ListView1.ColumnHeaders .Add(, , "住户名称", 1600 )
Me.ListView1.ColumnHeaders .Add(, , "使用日期", 1600 )
Me.ListView1.ColumnHeaders .Add(, , "备注", 3000 )
他这些东西是在传参数,加上括号这么看就清楚了。
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询