Jump to content

Create ListViewItem


Recommended Posts

When I create a listview item here:

For $value In $splitit
    If $value <> "" Then GUICtrlCreateListViewItem($value, $sListview); Creates the listview items from the INI file
 Next

at the very top of the listview there is a number 2, which 2 is how many listview items I have.

How can I get rid of it?

Full Code:

$itemID = _GUICtrlListViewGetCurSel($nListview)
                 $buddyText = _GUICtrlListViewGetItemText($nListview, $itemID, 1); Get the item ID of selected item
                 $itemName = INIRead("C:\buddies.ini", "OnlineBuddies", $buddyText, "")
                 $splitit = StringSplit($itemName, ","); Splits the strings
                 If $itemName = "" Then
                     _GUICtrlListViewDeleteAllItems($sListview)
                     GUICtrlCreateListViewItem("Offline", $sListview)
                 Else
                     _GUICtrlListViewDeleteAllItems($sListview)
                     $itemName = INIRead("C:\buddies.ini", "OnlineBuddies", $buddyText, ""); Reads key
                     $splitit = StringSplit($itemName, ",")
                     For $value In $splitit - 1
                        If $value <> "" Then GUICtrlCreateListViewItem($value, $sListview); Creates the listview items from the INI file
                     Next
                 EndIf
Edited by FireLordZi
While Alive() {
	 DrinkWine();
}
AutoIt Programmer
Link to comment
Share on other sites

Since splitit is just an array, I recommend using

For $i = 1 to Ubound( $splitit) - 1
    If Not ($splitit[$i] = '') Then GUICtrlCreateListViewItem($splitit[$i], $sListview); Creates the listview items from the INI file
Next

That is how I prefer doing it with arrays to using in. I usually only use in for objects.

Edited by Thatsgreat2345
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...