Sign in to follow this  
Followers 0
Tomoya

Having problems updating a ListView.

4 posts in this topic

#1 ·  Posted (edited)

I have a function that pulls names and addresses from a website and puts them into a list view along with a refresh button to update the changes from the website and put them in the ListView. My problem is that it seems to just delete all the items and put the exact same information back into the list without ever fetching the new information. I'm running out of ideas on what it could be.

Here is my function I am using.

Func _PLPull()
$array = 1 ;Clear the array to dump all data
$data = 1 ;Clear $data
Local $file = "c:wintemp13111.txt"
Local $src = InetGet("WEBSITE URL", $file)
$data = FileRead($file)

$array = StringSplit($data, ";", 1)
FileDelete($file)
For $n = 1 To UBound($array) - 2
If Mod($n, 2) Then
$subitem = _GUICtrlListView_AddItem($PList, $array[$n])
Else
_GUICtrlListView_AddSubItem($PList, $subitem, $array[$n], 1)
EndIf
MsgBox(5, "Error", $array & " -- " & $data)
Next

EndFunc ;==>_PLPull

Here is the Case for the button

Case $nMsg = $RefreshBtn
_GUICtrlListView_DeleteAllItems((GUICtrlGetHandle($PlayerList)))
_PLPull()

I don't know why it jacked up the spacing in my code, sorry. :/

Edited by Tomoya

Share this post


Link to post
Share on other sites



is your c:wintemp13111.txt being updated at some point? maybe the contents are not changing when you create your new array.

Perhaps adding a msgbox to display (or a consolewrite) the contents of $file or an array display on $array to show what it's reading inside your _PLPull function


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

By default, InetGet will retrieve the file from the cache. Try passing 1 for the optional third parameter.

Share this post


Link to post
Share on other sites

is your c:wintemp13111.txt being updated at some point? maybe the contents are not changing when you create your new array.

Perhaps adding a msgbox to display (or a consolewrite) the contents of $file or an array display on $array to show what it's reading inside your _PLPull function

I have. I removed my debug stuff before I posted it up but it sounds like DanP2 may be right and it is fetching it from the cache. I will try that.

By default, InetGet will retrieve the file from the cache. Try passing 1 for the optional third parameter.

Yep this was the problem. I didn't know that is how it fetched the cached version. Thanks.

Local $src = InetGet("WEBSITE", $file, 1)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0