Cravin Posted January 7, 2013 Share Posted January 7, 2013 (edited) Thanks Autobert, issue resolved. Edited January 7, 2013 by Cravin Link to comment Share on other sites More sharing options...
abberration Posted January 7, 2013 Share Posted January 7, 2013 You can simplify your code with _GUICtrlListView_DeleteItemsSelected. I tried your code with this line and it worked perfectly: _GUICtrlListView_DeleteItemsSelected($CompListView) Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Cravin Posted January 7, 2013 Author Share Posted January 7, 2013 You're right, but I also need it to remove the line from the computers.txt file as well... that's the issue Link to comment Share on other sites More sharing options...
abberration Posted January 7, 2013 Share Posted January 7, 2013 (edited) I did something similar with a program I wrote a few months ago. I used the function I mentioned above along with _GUICtrlListView_GetSelectionMark. Then I used _FileWriteToLine using blank text and parameter #4 with a "1" to delete the line from the file. That code should look something like this: _FileWriteToLine("computers.txt", $lineNumber, "", 1) Edited January 7, 2013 by abberration Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Cravin Posted January 7, 2013 Author Share Posted January 7, 2013 I did something like this below, but the problem is that when the text is added to the text file, and with how I can sort the list ascending vs descending, the GetSelectionMark number doesn't line up with the ListView item.. if that makes sense. Func delSelected() GUICtrlListView_DeleteItemsSelected($CompListView) Local $lineNumber = _GUICtrlListView_GetSelectionMark($CompListView) ConsoleWrite($lineNumber) FileWriteToLine("computers.txt", $lineNumber, "", 1) dataRefresh() EndFunc Link to comment Share on other sites More sharing options...
AutoBert Posted January 7, 2013 Share Posted January 7, 2013 I think this is the solution you are searching: Func delSelected() Dim $aRecords _FileReadToArray("computers.txt", $aRecords) Local $index = Int(_GUICtrlListView_GetSelectedIndices($CompListView)) $SelectedComp = _GUICtrlListView_GetItemTextString($CompListView, $index) For $x = 1 To $aRecords[0] If $aRecords[$x] = $SelectedComp Then _FileWriteToLine("computers.txt", $x, "", 1) Next dataRefresh() EndFunc ;==>delSelected Link to comment Share on other sites More sharing options...
Cravin Posted January 7, 2013 Author Share Posted January 7, 2013 AutoBert, You fricken nailed it. Thanks a million man. Link to comment Share on other sites More sharing options...
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