problem in making listview

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: May 2007
Posts: 538
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: problem in making listview

 
0
  #11
Jan 23rd, 2009
check out the bolded part of your code...i just mentioned the point where the code needs to be modified...

With BooK_Details
    set li = .ListItems.Add(, , (rs!Acc_No))
End With

get 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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 33
Reputation: chanthung is an unknown quantity at this point 
Solved Threads: 0
chanthung's Avatar
chanthung chanthung is offline Offline
Light Poster

Re: problem in making listview

 
0
  #12
Jan 24th, 2009
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.
You cant get to where you are going unless you know where you have been.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 538
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: problem in making listview

 
0
  #13
Jan 24th, 2009
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
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 538
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: problem in making listview

 
0
  #14
Jan 24th, 2009
My actual connection is DSN. so do i have to write the code differently to connect my databse to ListView1..?
whether you use DSN or DSN-Less connection, there is no need to write additional code for connecting lv with the database....just pass the connection string in form_load event, open the connection....make sure the you are using a global connection object....and that's it.....one global connection object will handle connecting to the database and this applies to all databound controls on your form....just make sure that the connection object is opened till you close the project....that's it...nothing else to do...

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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: jaasaria is an unknown quantity at this point 
Solved Threads: 1
jaasaria's Avatar
jaasaria jaasaria is offline Offline
Junior Poster

Re: problem in making listview

 
0
  #15
Jan 24th, 2009
try to remove the :

With BooK_Details
end with

and check the listview column you have.. by right click on the listview then goto properties and insert column as number of your fields loaded in the listview.

^_^
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 538
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: problem in making listview

 
0
  #16
Jan 24th, 2009
try to remove the :

With BooK_Details
end with
why to remove that??? there is no error at this syntax at all....
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 33
Reputation: chanthung is an unknown quantity at this point 
Solved Threads: 0
chanthung's Avatar
chanthung chanthung is offline Offline
Light Poster

Re: problem in making listview

 
0
  #17
Jan 29th, 2009
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..
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command13_Click()
  2. Dim db As Database ‘Copied from your previous post.
  3. Dim rs As Recordset
  4. Dim li As ListItem
  5.  
  6. prompt$ = "Please enter full book name"
  7. SearchStr$ = InputBox(prompt$, "book title search")
  8. If SearchStr$ = "" Then Exit Sub ‘ Accept the Book Name
  9. ' from the user
  10. Form7.Data1.RecordSource = "select * from Book_Details where Book_Name like '" & SearchStr$ & "%'"
  11. Form7.Data1.Refresh
  12.  
  13. Set db = OpenDatabase(App.Path & "\libraryic.mdb")
  14. Set rs = db.OpenRecordset("Book_Details", dbOpenTable)
  15.  
  16. ''Do While Not Form1.Data1.Recordset.EOF
  17. ''Data1.Recordset.MoveNext ‘was trying this method earlier
  18. ''While Not Data1.Recordset.EOF
  19. If rs.RecordCount > 0 Then
  20. rs.MoveFirst
  21. While Not rs.EOF()
  22. ‘here I want to add the Columns and display all SubItems (DB records)
  23. With BooK_Details
  24. Set li = .ListItems.Add(, , (rs!Acc_No))
  25. li.SubItems(1) = IIf(IsNull(rs!Book_Name), "", rs!Book_Name)
  26. li.SubItems(2) = IIf(IsNull(rs!Author), "", rs!Author)
  27. li.SubItems(3) = IIf(IsNull(rs!Publisher), "", rs!Publisher)
  28. li.SubItems(4) = IIf(IsNull(rs!Stock), "", rs!Stock)
  29. li.SubItems(5) = IIf(IsNull(rs!Rack_No), "", rs!Rack_No)
  30. li.SubItems(6) = IIf(IsNull(rs!Classification_No), "", rs!Classification_No)
  31. End With
  32. rs.MoveNext
  33. Wend
  34.  
  35. Form7.Show
  36. End If
  37. End Sub
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
You cant get to where you are going unless you know where you have been.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 33
Reputation: chanthung is an unknown quantity at this point 
Solved Threads: 0
chanthung's Avatar
chanthung chanthung is offline Offline
Light Poster

Re: problem in making listview

 
0
  #18
Feb 3rd, 2009
Can anyone please make a comment....so that i can go ahead.
Thanks
You cant get to where you are going unless you know where you have been.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC