Need some help - ListBox Counter - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: Need some help - ListBox Counter (/showthread.php?tid=19820) Pages:
1
2
|
Need some help - ListBox Counter - Fragma - 06-22-2011 I've coded an application which allows people to import a list of usernames, and check whether or not they are available on the website Habbo Hotel. What I want to do though, is add a counter at the bottom (a Label), which displays the number of accounts that have been tested. This is a really simple task but I can't for the life of me work out how to do it, as I haven't coded anything for a long time.. Here is my current code: Code: For Each fn As String In ListBox1.Items Thanks. RE: Need some help - ListBox Counter - Fragma - 06-23-2011 Can anybody help me out with this? RE: Need some help - ListBox Counter - thanasis2028 - 06-29-2011 Add a label named label2 and change its default text to "0". The use this code: Code: For Each fn As String In ListBox1.Items RE: Need some help - ListBox Counter - Fragma - 06-30-2011 Nice one mate thanks for that, works a charm! RE: Need some help - ListBox Counter - ★ASI_F★™ - 06-30-2011 i also need that thanks thanasis2028 it works RE: Need some help - ListBox Counter - Injection - 07-01-2011 For Each fn As String In ListBox1.Items Try Dim myDatabuffer As Byte() = myWebClient.DownloadData("http://habbo.com/home/" & fn) Dim download As String = Encoding.ASCII.GetString(myDatabuffer) Catch Ex As Exception RichTextBox1.AppendText((Chr(10) & fn)) Finally Label2.Text=CStr(CDbl(Label2.Text)+1) End Try Next Label1.Text = "Done" Should work RE: Need some help - ListBox Counter - AceInfinity - 07-03-2011 Why are you all using loops for this, it will only slow down the application for such a simple task, all you need is this: Code: ListBox1.Items.Count lol... If you had over 1000 entries, your methods would cause the application to render unresponsive, and crash. I'd like to see a coders group here soon so that more people can become educated with all different programming languages out there. It would be nice on this forum I think Spoiler (Click to View) RE: Need some help - ListBox Counter - Fragma - 07-03-2011 The For Each loop isn't there for the counter, it is there to go through each item in the ListBox control. The counter is just additional, so people know the status of the scan. RE: Need some help - ListBox Counter - AceInfinity - 07-03-2011 Quote:What I want to do though, is add a counter at the bottom (a Label), which displays the number of accounts that have been tested I only saw the mention of numbers there, but i'm confused now, You want the label to display every item in the list? or the label to display the count of the list? Either way you should have a download buffer to download in chunks (a specified number of bytes,) whatever your program is trying to download. It will keep your program from locking up and becoming unresponsive from bigger data downloads. RE: Need some help - ListBox Counter - Fragma - 07-03-2011 (07-03-2011, 04:03 AM)Ace Wrote: I only saw the mention of numbers there, but i'm confused now, You want the label to display every item in the list? or the label to display the count of the list? thanasis2028's code worked for counting each item in the list that had been "scanned". The program doesn't lock up or freeze as it's running through a background worker. It's actually surprisingly quick. |