Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

delete item in Listbox and pc

How to delete items from ListBox .
Delete Selected Item:
Code
ListBox1.Items.Remove(ListBox1.SelectedItem)

I don't get the "pc" problem there.
(Dec 12, 2015 07:01 PM)Rhez Wrote:  Delete Selected Item:
Code
ListBox1.Items.Remove(ListBox1.SelectedItem)

I don't get the "pc" problem there.

this code only clear ListBox not delete text file in folder Example , sorry for english 😟
look this :
s15.postimg.org/ano0vny23/Screenshot_1.jpg

and this

s11.postimg.org/6qh3x6pr7/Screenshot_2.jpg
Sooo File.Delete from IO namespace? You need to take some initiative and search things for yourself.
I search in internet and with File.Delete not working

foreach (var item in listBox1.SelectedItems)
{
File.Delete((string)item);
}
(Dec 13, 2015 06:09 AM)Natus12345 Wrote:  I search in internet and with File.Delete not working

Strong type your iterator and it'll handle the casting for you.

Code
foreach (string path in listBox1.SelectedItems)
    File.Delete(path);

Have you changed your ListBox control's SelectionMode property? It should be set to MultiSimple/Extended.
(Dec 13, 2015 08:25 AM)Odus Wrote:  Strong type your iterator and it'll handle the casting for you.

Code
foreach (string path in listBox1.SelectedItems)
    File.Delete(path);

Have you changed your ListBox control's SelectionMode property? It should be set to MultiSimple/Extended.

look this :
s10.postimg.org/ou31a6ent/image.jpg

s10.postimg.org/btradqs3d/image.jpg
(Dec 13, 2015 10:22 AM)Natus12345 Wrote:  s10.postimg.org/btradqs3d/image.jpg

Read what it said. You still have it open in notepad or something.
(Dec 13, 2015 10:40 AM)Odus Wrote:  Read what it said. You still have it open in notepad or something.

s29.postimg.org/825jhqsh3/Screenshot_1.jpg
My god, don't post fucking prints, the error is self explanatory, you may not understand english, but i can't translate it more cause it's clearly self-explanatory!

The file is being used by another process.

Next time, copy the error code and details, not taking a fucking print which i need to zoom and guess some words.
Topic can close my friend solve the error .


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Mr. Money™Jun 29, 2017 07:41 AM 17 463 Jun 29, 2017 07:41 AM
Last Post: Mr. Money™
[Python] by DARPANov 2, 2016 07:26 AM 3 203 Nov 2, 2016 07:26 AM
Last Post: lilo
[Shell] by ♦ [̲̅$̲̅(̲̅1000)̲̅$̲̅] ♦Sep 21, 2016 05:50 AM 0 246 Sep 21, 2016 05:50 AM
Last Post: ♦ [̲̅$̲̅(̲̅1000)̲̅$̲̅] ♦