How to update listview ONLY when new data is avilable?

You can talk about VB programming here

Postby autopilot » Mon May 07, 2007 8:39 pm


Hope this clears it up... make the code from your post above part of a function or sub called refreshlistview... then in another sub use something like:
Code: Select all
Dim objDocCopy As MSXML2.DOMDocument
private sub XMLCompair()
  Dim objDoc As MSXML2.DOMDocument

  'load the xml document
  Set objDoc = New MSXML2.DOMDocument
  objDoc.async = False
  objDoc.Load "http://localhost/xmloutput.php"

  'compair files
  if objDoc <> objDocCopy then
     objDocCopy = objDoc
     refreshlistview()
  end if
end sub


you only want to process the xml if it has changed... so you want to load the web page, check if it has changed, and if it has, make a copy of it and then refresh the listview.

autopilot
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby method » Mon May 07, 2007 8:50 pm

thanks for your reply. Loading what page?

In Onload event i prepare listview1 and i start the timer and from inside timer i call populatelistview that holds my code. populatelistview reload listview .

So where should i use your code?what should be inside refreshlistview() ?

You never mentioned timer? how then i do the check regulerly?
Last edited by method on Mon May 07, 2007 9:13 pm, edited 6 times in total.
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby autopilot » Tue May 08, 2007 7:43 am

method wrote:thanks for your reply. Loading what page?

"http://localhost/xmloutput.php"

method wrote:In Onload event i prepare listview1 and i start the timer and from inside timer i call populatelistview that holds my code. populatelistview reload listview .
Instead of calling populatelistview from your timer, call XMLCompair from my previous post and from XMLCompair call populatelistview (instead of refreshlistview) if the 2 xml files are different.
method wrote:So where should i use your code?what should be inside refreshlistview() ?

You never mentioned timer? how then i do the check regulerly?
i never mentioned how to use the timer because i thought you would be able to figure out how to put it together on your own.

autopilot
Last edited by autopilot on Tue May 08, 2007 7:59 am, edited 2 times in total.
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby method » Tue May 08, 2007 10:30 am

I already tried what you have suggested before your post but i keep getting this error:

Run-time error 453

object doesn't support this property or method


pointing at
'compair files
If objDoc <> objDocCopy Then


furthermore,shouldn't this line:
Dim objDocCopy As MSXML2.DOMDocument

be outside compair function?
Last edited by method on Tue May 08, 2007 10:38 am, edited 1 time in total.
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Postby autopilot » Tue May 08, 2007 11:04 am

method wrote:furthermore,shouldn't this line:
Dim objDocCopy As MSXML2.DOMDocument be outside compair function?
if you look back up at my post, it is outside the sub
autopilot wrote:
Code: Select all
Dim objDocCopy As MSXML2.DOMDocument
private sub XMLCompair()
just a note... you may need to dim as new
Code: Select all
Dim objDocCopy As New MSXML2.DOMDocument

as far as you getting an error, i am not sure what to tell you... i have never used vb6... i did basic programming a long time ago (15 yrs or more) and just in the last 2 yrs i have started programming with vb 2005... so i dont know what else to tell you...

but i will look at compairing xml files with vb 2005 and see what i can come up with... but the <> should work (i never tested it though)

autopilot
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby autopilot » Tue May 08, 2007 12:38 pm

You may have to use the .innertext to make the compair... try the following:
Code: Select all
  'compair files
  If objDoc.InnerText <> objDocCopy.InnerText Then
     objDocCopy = objDoc
     populatelistview()
  end if


autopilot
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 358
Joined: Sat Sep 23, 2006 7:19 pm

Postby method » Tue May 08, 2007 1:09 pm

I get this error now:
Compile error:

Method or data member not found

pointing at:

.
InnerText
Last edited by method on Tue May 08, 2007 1:10 pm, edited 1 time in total.
method
imFiles Master
imFiles Master
 
Posts: 686
Joined: Tue Oct 18, 2005 11:12 am

Previous

Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests