Where's the count function for ?
Why you dont just use
listview.items.add("") ?
guys. I need some help here.
if I want to add something to the listbox by this code
it just appears as 1 and it can't add other items no longer..Code:Public Sub Add_Item( _ ByVal Moderator As String, _ ByVal User As String, _ ByVal Type As String, _ ByVal Points As String, _ ByVal Reason As String) Dim Count As Integer = 0 ListView1.Items.Add(Moderator) ListView1.Items(Count).SubItems.Add(User) ListView1.Items(Count).SubItems.Add(Type) ListView1.Items(Count).SubItems.Add(Points) ListView1.Items(Count).SubItems.Add(Reason) Count += 1 End Sub
could someone solve this problem... thanks.
Where's the count function for ?
Why you dont just use
listview.items.add("") ?
ITS MEH BITCHESSS !!!
There is no count "function" there, and this sub is to simplify work obviously.
@OP
Okay first off, your logic is all wrong for the count variable.
[php]
Dim Count As Integer = 0
ListView1.Items.Add(Moderator)
ListView1.Items(Count).SubItems.Add(User)
ListView1.Items(Count).SubItems.Add(Type)
ListView1.Items(Count).SubItems.Add(Points)
ListView1.Items(Count).SubItems.Add(Reason)
Count += 1
[/php]
Let's see...every time you call the sub you're declaring an integer with a value of 0, so it's going be 0 all the time...
Instead try:
[php]
Public Sub Add_Item( _
ByVal Moderator As String, _
ByVal User As String, _
ByVal Type As String, _
ByVal Points As String, _
ByVal Reason As String)
Dim Count As Int32 = Me.ListView1.Items.Count-1
ListView1.Items.Add(Moderator)
ListView1.Items(Count).SubItems.Add(User)
ListView1.Items(Count).SubItems.Add(Type)
ListView1.Items(Count).SubItems.Add(Points)
ListView1.Items(Count).SubItems.Add(Reason)
End Sub
[/php]
That should work.
EDIT: For the sake of a better explanation + I'm bored:
By changing count to "Me.ListBiew1.Items.Count-1" you've assigned the variable "count" to a dynamic value that will change as more items are added, rather than a static "0" which will never change which resulted in you finding it kept overwriting previous entries right?
Last edited by Jason; 10-02-2010 at 09:35 AM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
confict (10-02-2010),nathanael890 (10-03-2010)
[php] Dim Count As Int = 0
ListView1.Items.Add(Moderator)
Count = ListView1.Items.Count-1
ListView1.Items(Count).SubItems.Add(User)
ListView1.Items(Count).SubItems.Add(Type)
ListView1.Items(Count).SubItems.Add(Points)
ListView1.Items(Count).SubItems.Add(Reason) [/php]
Else, the first count will be -1.
Just create the item variable, add subitems to it.. and then add that item to the list... :\ no need for all that stuff
Light travels faster than sound. That's why most people seem bright until you hear them speak.
Oops thanks for that little error fix Kevin, turns out I had the the fail logic.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
thanks for the codes guys. I just tried to create my program for managing a forum because I'm also a moderator of it. so I want to record my status on it ^^
*Solved