我在vb6中开发了一个在Windows XP中正常运行的应用程序,但是当我尝试在Windows 7上运行它时,它显示运行时错误380,无效属性。以下是导致错误的代码:
Private Sub getData()
txtID.Text = rs!emp_id & ""
txtDept.Text = rs!dept_name & ""
txtDesig.Text = rs!desig_name & ""
txtName.Text = rs!emp_name & ""
txtPFNo.Text = rs!PF_ACC_NO & ""
cdDate.Text = Format(rs!PF_DATE, "dd/mm/yyyy") '(This line produces the error)
txtOwnSubs.Text = rs!SubsO & ""
txtUCont.Text = rs!ContU & ""
txtOptional.Text = rs!Optional & ""
txtLoanSanc.Text = rs!LoanSanc & ""
txtLoanRec.Text = rs!LoanRecovery & ""
txtInt.Text = rs!RateOfInt & ""
txtOSubs.Text = rs!OpeningO & ""
txtOcont.Text = rs!OpeningU & ""
txtCSubs.Text = rs!ClosingO & ""
txtCCont.Text = rs!ClosingU & ""
txtIntDurOwn.Text = rs!InterestO & ""
txtIntDurCont.Text = rs!InterestU & ""
txtIntUptoOwn.Text = rs!CInterestO & ""
txtIntUptoCont.Text = rs!CInterestU & ""
txtTotIntO.Text = rs!CInterestO & ""
txtTotIntC.Text = rs!CInterestU & ""
txtWithdrawn.Text = rs!withdrawn & ""
If rs!Type & "" = "N" Then
cboType.ListIndex = 0
Else
cboType.ListIndex = 1
End If
End Sub
注意:我已经使用cdDate创建了DateCheck.ocx。
答案 0 :(得分:1)
如果cdDate
是DateTimePicker
,则您很可能应该使用.Value
属性而不是.Text
。
答案 1 :(得分:0)
将该行分成多个步骤以找出导致错误的部分。
Dim vnt As Variant
vnt = rs!PF_DATE
Dim sDate As String
sDate$ = Format(vnt, "dd/mm/yyyy")
cdDate.Text = sDate
然后进一步调查:)