| | |
problem in making listview
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
check out the bolded part of your code...i just mentioned the point where the code needs to be modified...
get me a feedback if this works out...
regards
Shouvik
With BooK_Details
set li = .ListItems.Add(, , (rs!Acc_No))
End Withget me a feedback if this works out...
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
first of all my apology to all for reopening this SOLVED thread.
I am knid of new to vb programming, so maybe i am missing something. But Thanks a lot for the help. Actually i am still getting error. My actual connection is DSN. so do i have to write the code differently to connect my databse to ListView1..? I am kind of struggling with ListView and Database connection using DSN.
Set Li = . ListItems.Add (, ,(rs!Acc_No)) is corrected as you have instructed.
I am still getting this message when i compile.
Runtime Eror : '424'
Object Required
Thanks a lot again.
Have a good day.
I am knid of new to vb programming, so maybe i am missing something. But Thanks a lot for the help. Actually i am still getting error. My actual connection is DSN. so do i have to write the code differently to connect my databse to ListView1..? I am kind of struggling with ListView and Database connection using DSN.
Set Li = . ListItems.Add (, ,(rs!Acc_No)) is corrected as you have instructed.
I am still getting this message when i compile.
Runtime Eror : '424'
Object Required
Thanks a lot again.
Have a good day.
You cant get to where you are going unless you know where you have been.
see there are many reasons for which you can get error 424...
for example,if u mistyped a control name which is not exist at all in your project aka form....or any dependencies like any external components that you referenced previously in your project but which is not exist presently....you might have uninstalled that from your system.....or you have used some variables in your code for which you haven't mentioned the correct datatype....
according to you....this problem can arise from your listview control....make sure that you typed the correct object name for the lv in your code.....lets say...in the code you have used listview1...make sure that you have the control on your form with object name "listview1".....otherwise the compiler won't recognize that...
or it will be more better...if you posted the actual ping point of your code where you are getting the error....may be post the full code if possible.....coz accroding to the code there is no error at all...but there seems to be some other error in the code...but for that the code needs to supervised...
now the choice is yours....
regards
Shouvik
for example,if u mistyped a control name which is not exist at all in your project aka form....or any dependencies like any external components that you referenced previously in your project but which is not exist presently....you might have uninstalled that from your system.....or you have used some variables in your code for which you haven't mentioned the correct datatype....
according to you....this problem can arise from your listview control....make sure that you typed the correct object name for the lv in your code.....lets say...in the code you have used listview1...make sure that you have the control on your form with object name "listview1".....otherwise the compiler won't recognize that...
or it will be more better...if you posted the actual ping point of your code where you are getting the error....may be post the full code if possible.....coz accroding to the code there is no error at all...but there seems to be some other error in the code...but for that the code needs to supervised...
now the choice is yours....
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
•
•
•
•
My actual connection is DSN. so do i have to write the code differently to connect my databse to ListView1..?
but you have to make sure that the DSN must exist in the ODBC admin. before you try to connect through your code....and ofcourse the connection string should differ in case of DSN connection rather that DSN-Less connection....
regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Have a problem? Don't worry just give me a call and I'll fix it for you.
Thanks to both of you for sharing your knowledge and sorry for my late response. Ok, so here is my code. This part of my program will accept a Book Name from the user and search through the database and display it in the List View else display Book not found message. Problem is I can’t find about List View in Books I am referring to. So I will be so grateful for help or suggestions..
What I have in mind is this… but I am like all mixed up now!!
Acc No | Book Name | Author | Publisher
123 NNNN PP LLLL
234 BBBN YUH bpb
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command13_Click() Dim db As Database ‘Copied from your previous post. Dim rs As Recordset Dim li As ListItem prompt$ = "Please enter full book name" SearchStr$ = InputBox(prompt$, "book title search") If SearchStr$ = "" Then Exit Sub ‘ Accept the Book Name ' from the user Form7.Data1.RecordSource = "select * from Book_Details where Book_Name like '" & SearchStr$ & "%'" Form7.Data1.Refresh Set db = OpenDatabase(App.Path & "\libraryic.mdb") Set rs = db.OpenRecordset("Book_Details", dbOpenTable) ''Do While Not Form1.Data1.Recordset.EOF ''Data1.Recordset.MoveNext ‘was trying this method earlier ''While Not Data1.Recordset.EOF If rs.RecordCount > 0 Then rs.MoveFirst While Not rs.EOF() ‘here I want to add the Columns and display all SubItems (DB records) With BooK_Details Set li = .ListItems.Add(, , (rs!Acc_No)) li.SubItems(1) = IIf(IsNull(rs!Book_Name), "", rs!Book_Name) li.SubItems(2) = IIf(IsNull(rs!Author), "", rs!Author) li.SubItems(3) = IIf(IsNull(rs!Publisher), "", rs!Publisher) li.SubItems(4) = IIf(IsNull(rs!Stock), "", rs!Stock) li.SubItems(5) = IIf(IsNull(rs!Rack_No), "", rs!Rack_No) li.SubItems(6) = IIf(IsNull(rs!Classification_No), "", rs!Classification_No) End With rs.MoveNext Wend Form7.Show End If End Sub
Acc No | Book Name | Author | Publisher
123 NNNN PP LLLL
234 BBBN YUH bpb
You cant get to where you are going unless you know where you have been.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: VB Image resources and using them
- Next Thread: plss give me some codes using palindrome in visual basic 6.0
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 429 2007 access activex add age append application basic beginner birth c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





