FireLordZi Posted January 17, 2008 Posted January 17, 2008 (edited) 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 January 17, 2008 by FireLordZi While Alive() { DrinkWine(); }AutoIt Programmer
Thatsgreat2345 Posted January 17, 2008 Posted January 17, 2008 (edited) 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 January 17, 2008 by Thatsgreat2345
FireLordZi Posted January 17, 2008 Author Posted January 17, 2008 Thanks. That solved the problem 8) While Alive() { DrinkWine(); }AutoIt Programmer
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now