How can i loop over treeview selected nodes and then to delete each node if it's a directory or a file ?

I have this code:
if (s == "file")
file = false;
for (int i = 0; i < treeViewMS1.SelectedNodes.Count; i++)
DeleteFile(treeViewMS1.SelectedNode.FullPath, file);
I know it's a file and it is working if it's a single file.
On the treeView i click on a file right click in the menu i select delete and it's doing the line:
DeleteFile(treeViewMS1.SelectedNode.FullPath, file);
And it's working no problems.
But i want to do that if i selected some files togeather multiple selection then to delete each file.
So i added the FOR loop but then how do i delete from the SelectedNodes each node ?
The treeView SelectedNodes dosen't have FullPath like SelectedNode also doing SelectedNodes[i] dosen't have the FullPath property.
Same as for if i want to delete a single directory or multiple selected directories:
This is the continue of the code if it"s not a "file" (else) it's null i know it's a directory and doing:
else
file = true;
RemoveDirectoriesRecursive(treeViewMS1.SelectedNode, treeViewMS1.SelectedNode.FullPath);
Also here i'm using SelectedNode but if i marked multiple directories then i how do i loop over the SelectedNodes and send each SelectedNode to the RemoveDirectoriesRecrusive method ?
My problem is how to loop over SelectedNode(multiple selection of files/directories) and send each selected file/directory to it's method like i'm doing now ?

foreach (TreeNode n in treeViewMS1.SelectedNodes)
// Remove everything associated with TreeNode n here
I don't think it's any harder than that, is it?
If you can multi-select both an item and one of its descendents in the tree, then you'll have the situation that you may have deleted the parent folder and all of its children by the time you get around to deleting the descendent.  But that's not such
a big deal.  A file can get deleted externally to your program too - so you'll just have to deal with it having been deleted already (or externally) when you get around to deleting it yourself.

Similar Messages

  • How can you keep the caps lock on and not unlock after each letter?

    How can you keep the caps lock on and not unlock after each letter?

    I'm not aware of an online keyboard that is available and can do this. Most likely it would need to be a function of the app itself (which can and sometimes do add functionlaity to the keyboard).
    Wireless keyboard might handle that, if that's an option for you.
    I work in IT myself, and IMHO the iPad isn't the ideal device for coding or scripting work.

  • How can I get Firefox to "grab onto" and then "hold onto" the data signal until I tell Firefox to release it at the end of my session of internet browsing?

    ok, I hope that my description of this problem does not come out in such a disorganized fashion that it makes the description difficult to follow. here goes: every 30 seconds to 1 minute (or thereabouts, I'm estimating) my mobile phone's browser (whether Firefox or any other) loses the data signal, so that tje next time that. I click on something, I get an error message that the "data connection timed out, retry" or "network unavailable" or "check that you are connected to that internet", etc. etc. etc. I have downloaded many apps that are supposed to boost data connectivity and/or improve internet speed, blah, blah, blah, till I discovered that was a problem with the server being able to keep up with staying locked onto my browser. in one of these apps diagnostic screens, I found a notation that therr was something wrong with my cell's relative position. well, how could that be, I wondered, since I had "GPS tracking" "GPS reporting" and "location sharing" all enabled? but, then I noticed, on the image of my cell's location as represented by this particular app, that every half minute, or so, the blue dot which represented my cell's location would slip to the left about one quarter of an inch, or so, and in the longitude and latitude part of this app's diagnostic screen I saw that the numerical designations of my cell's longitude and latitude were zero and zero. it suddenly occurred to me that the server had lost sight of my cell because my cell had moved too far out of the range of that server's sight due to the rotation of the earth. well, blow me down, what am I supposed to do to fix that? how can I tell my cell phone's OS to send out some kind of identifying info on a constant basis, so that the server could keep track of it (and I would not lose the signal)? or, conversely, how could I get my cell phone's browser to grab onto the signal and not let go of it until I was done with that internet session, at which time I would then manually release the signal myself? I hope that my explanation of the problem made enough sense that you could follow it and that you can come up with a workable solution for me. oh yeah, my phone is an LG OPTIMUS ELITE 696. thanx, from the enragedkangaroo.

    Hello,
    I'm afraid I don't think there is going to be much we can do to help you here. The description sounds like an issue with the phone rather than with Firefox specifically.
    I don't think the problem can be caused by you moving out of range of the cell, due to the rotation of the earth. The cell towers (that provide phone signal) are sitting on the earth, just like you, and so move at the same speed as you. This might be a concern with satellite phones using Low Earth Obit satellites but this isn't the case here.
    I think the best thing to do would be to get in touch with your Phone Operator or Device Manufacturer for support. If you are out of the support period or can't get support from them for some other reason then a standard 'cure-all' for mobile phones is to do a Factory Reset. This will return your phone to its default factory settings and wipe all of your data / modifications off the phone. This tends to solve most problems and is probably what the official support team would tell you to do. I can't guarantee that it will help but it has a good chance.
    There are instructions on resetting your phone here:
    http://www.hard-reset.com/lg-optimus-elite-hard-reset.html
    I hope that helps.

  • How can I copy picture on a CD and then play them on the blue ray player on my TV?

    How can I copy pictures from iphoto on a CD then play it on my blueray player on the TV?

    You are attempting to do this in a very difficult manner. Why not simply get an AppleTV ($75 refurbished from Apple) and you can share all your iPhoto content on your TV. That would be much easier than exporting to a CD/DVD, loading it into a player and then playing from a DVD. Apple tells about setting up Home Sharing in http://support.apple.com/kb/ht4352.

  • How can I open a program using Java and then perform certain tasks with it?

    For example, and this is just an example, I want to write a Java program that opens MS Paint and then manipulates that program. This can be useful to automate certain tasks.
    My question is whether this can be done writing Java code and if so how? If not possible, would I need to use a scripting language instead?

    write a Java program that opens MS Paint and then
    manipulates that program. This can be useful to
    automate certain tasks."manipulates" is a too wide term. Let me narrow down:
    1. If you want to open (run) the program and then shut (kill) it down it is possible and fairly trivial to do in java. Look up Runtime and Process classes in java.lang package
    2. If you want to open the program and edit some image/document in the opened program. It is very difficult in java. May be possible... using some Java/COM bridge, assuming your native program is COM/Active-x compliant. Note: these things go beyond the boundary of JVM and needs to interact with host OS and involves shared memory, ipc and all "low level" stuffs.
    If you want to be able to play around with these COM/Activex apps- choose .NET instead :-)
    3) You can open the program from java and pass it some command line arg as in (1) above and then the program will load that document/image at startup automatically. You may then edit the doc/image thru that program itself. However, Java is not doing anything for you here, other than just starting off your native mspaint.exe ot notepad.exe.
    -BJ
    Message was edited by:
    Bimalesh

  • How can I uninstall the numerous Firefox applications and then download the latest version. I inadvertently installed Firefox applications . Can you please help?

    How can I uninstall Firefox and then download the latest version. I inadvertently downloaded too many and they won't download correctly. I have a Macmini Leopard.
    == This happened ==
    Not sure how often
    == Not sure ==
    == User Agent ==
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9

    Hi, Barbara! Is the problem that you have a lot of different versions of Firefox on your launch bar? Or that you have a lot of different versions in a directory somewhere?
    Either way, on the mac, you should be able to simply:
    1. Close all versions of Firefox
    2. Drag the applications to the trash folder, which will remove them from the folder or your dock
    3. Download Firefox with Safari at getfirefox.com
    4. Open the downloaded file by double clicking it
    5. Once that happens you will have a Firefox icon and a folder with an "A" on it
    6. Drag the Firefox icon onto the A, which will install it into your Applications folder
    7. Open your Applications folder and drag it onto your main dock
    8. You should be able to launch it from your dock by clicking on the Firefox icon.
    Thanks!

  • How can I change the sites homepage 365 and then make the changes public?

    Hi is there any way I can change the look of the sites homepage and make it public so anyone who logs in see's the additoinal webparts etc.
    it seems I can only create a personal view of the sites page which is slightly annoying as I would like to add a few announcements for users on the Intranet who go to the sites page.

    I created a link to the sites page as shown in the image above.
    but I noticed the link goes like this:
    https://mydomain.my.sharepoint.com/personal/ausername/Social/Sites.aspx
    how can I link to the sites page without having to link to a particular user? what would be the link for that so when it goes to the sites page it goes to the sites page for that particular person?
    thanks

  • How can i merge data between two tables and then insert to another table

    Hi ,
    Could pls help me,
    I have two tables i need to merge this tables for a single column then need to insert the records to a third table
    Ex-
    Suppose emp, dept two tables , merge this two tables for empid then insert that value to emp_dept table.
    I am using oracle 10g.
    Thanks

    Hi,
    too many values comes from the select clause. I stated you have to match the columns from the emp_dept table to the columns in the select. In my example I return all the columns of emp and dept, but I think you have only one empid column, the select for example will give 2, one empid from emp and one empid from dept. So best is to match:
    insert into emp_dept
    (column1,column2,column3,empid)
    select emp.column1, emp.column2, dept.column3, emp.empid
    from   emp, dept
    where emp.empid = dept.empidAbove is an example how you can match, so the number of columns in the insert should match with the number of columns coming from the select.
    But better for us to help you is give your definitions of emp, dept and emp_dept.
    Herald ten Dam
    htendam.wordpress.com

  • My ipod Touch 5th is locked how can I back up to my computer and then restore?

    Well I changed my passcode and totally forgot it, I just got it for Christmas so I purchased some stuff and also have pictures I would hate to loose!! Please hlep me I dont know how to back up to itunes because the left bar that says back up does not allow me to do anything on that tab! I am frustrated and need help!!
    Please post answer here
    Thanks,
    Skykisser
    <Email Edited by Host>

    Since it is off-line, there is nothing you can do to find it except to use the old fashioned way, like if you lost a wallet or purse.
    There maybe an app to take a photos I know there are ones that will periodically send an email with location. However, you have to have the iPod to set it up/install it.
    However, since the iPod relies upon wifi they frequently can't connect to the internet

  • How can I record content FROM an iPad and then publish it back to an iPad?

    Everything I search for talks about pushing content out to an iPad, but what if I want to capture/record content from an iPad? I am trying to do a software simulation, rather than a straigh record.
    I did find a third party application called Reflection that allows me to mirror, or reflect, the iPad onto my computer. The problem is that due to the way the content transmits from the iPad, I would have to manually capture each screen and corresponding action within Captivate.
    Any advice on on this?

    Hello,
    Welcome to Adobe Forums.
    I am not sure about the 3rd Party Application but if you can create a .mp4 video of your IPAD simulation then you can insert that video in Adobe Captivate 6 as a Slide Video.
    Thanks,
    Vikram

  • How can I take backup in External HardDrive and then reinstall new OS and then restore data from External Hard Drive

    I have goot some issue with my Macbook i7, I am not able to start my Macboook its keep showing the Grey screen after login.
    I have done something where I have successully taken the OS backup on External Hardrive which was saying computer will start automatically. After this I founded a Fresh new computer but may be that was running on External hard drive.
    I am **** confuse what should I do next?
    Anyhelp wold be great......

    Delete the user account, then use the "Erase Free Space" option in the Erase tab of Disk Utility to write zeroes to the drive. Stick with the "Fastest" method (one pass of zeroes) unless you're hiding secrets from the NSA - anything more stringent is a waste of time.
    Matt

  • How can I delete a file? At the moment I delete each pic and it takes ages! I tried select all and managed to delete all my 2300 photos!!  I've got them back but I've also got back 980 which I had already deleted 1 by 1 over the past 6 months!  Help!

    Please help! How can I delete a file without deleting all my photos?  I have just managed to delete all my more than 2000 photographs by choosing' Select all' and then delete. But I thought only 'all' the photographs in the file I had open would be selected! I have got them back, but I've also got back more than 800 others that I'd deleted SINGLY over the last 6 months! HELP!

    Put a Photo in the iPhoto Trash.
    iPhoto Menu -> Empty Trash
    This removes the photo from iPhoto and the Hard Disk (in every version of iPhoto except iPhoto11)
    In iPhoto 11 the file goes to the System Trash, you need to empty that too.
    Regards
    TD

  • My ipad has gone in lost mode by mistake and now i have it and i enter the password and i cant enter my ipad how can i enter or restart the ipad and start back over new

    my ipad has gone in lost mode by mistake and now i have it and i enter the password and i cant enter my ipad how can i enter or restart the ipad and start back over new

    FORCE IPAD INTO RECOVERY MODE
    1. Turn off iPad
    2. Turn on computer and launch iTunes (make sure you have the latest version of iTune)
    3. Plug USB cable into computer's USB port
    4. Hold Home button down and plug the other end of cable into docking port.
    DO NOT RELEASE BUTTON until you see picture of iTunes and plug
    5. Release Home button.
    ON COMPUTER
    6. iTunes has detected iPad in recovery mode. You must restore this iPad before it can be used with iTunes.
    7. Select "Restore iPad"...
    Note:
    1. Data will be lost if you do not have backup
    2. You must follow step 1 to step 4 VERY CLOSELY.
    3. Repeat the process if necessary.

  • How can I force any new selection from bookmark to open in a new frame ?

    How can I force any new selection from bookmarks to open in a new frame ?

    Sorry I would like it happen as a preference,
    automate the option like
    "Always open in new tab when click Bookmark "
    (not over the actual tab)
    thanks

  • I try to find something on my iPad, many results are emails, when I push on an email I can't see the email, because I get ever the first email,or the previous selected email in my inbox. How can I see the email selected?

    I try to find something on my iPad, many results are emails, when I push on an email I can't see the email, because I get ever the first email,or the previous selected email in my inbox. How can I see the email selected?

    Is your Yahoo account set up as POP3 or IMAP?

Maybe you are looking for

  • Dashboard prompt in Obiee 11g

    Hi, I have a requirement to hide dashboard prompt, and display it only if the previous prompt has a user input. For example, first I need to display a prompt for Country, if the user selects a value, the show a prompt for State, and if a user selects

  • SALES Analysis  and profit loss statment

    Hi All , Dear Experts,                              My Sales Analysis and profit loss statement Value is deferent .  i want to know that which entry show in sales analysis and which entry show in profit loss statment . Thanks & Regard AREEBA ALI

  • How to control ship-complete in STO process

    Hi Experts, The issue as follows and it is urgent.How can we convay the suplying plant to ship completely at PO Level.user don't want partial delevey in STO process. how to ship all together in the STO process. I am going to place a purchase order in

  • [SOLVED] Major weird issues with KDE/Qt apps and unicode

    Hi, I've tried to search for my problem, but nothing has showed up, so if this has already been answered, please forgive me. Anyway, I use KDE as my primary desktop environment with SKIM as my unicode input method. After installing SKIM and Japanese

  • Front Row not marking video as watched properly

    I kept hoping that this issue would be resolved with one of the point releases, but here we are at 10.6.3 and it's still the same for me, so here's the problem. Before installing 10.6 I was running 10.5.8 and when using Front Row to watch a video (sa