|
bashiwala wrote: delete all non empty subfolders and files under a directory.
HINT: "recursion"
led mike
|
|
|
|
|
Hi,
Thanks for the hint. But even using Recursion requires non empty directory, isn't it ? I want to delete all subfolders and files regardless they are empty or non empty.
Is there any easy way ?
|
|
|
|
|
bashiwala wrote: But even using Recursion requires non empty directory, isn't it ?
Sure it does, but the trick is that you recursively call your method for all current subfolders and delete them afterwards when everything inside was deleted. Here some pseudocode to get you an idea of the recursive function.
void delete(string directory)
{
delete all files in directory
for all subdirectories in directory
{
call delete with current subdirectory
delete the now empty subdirectory
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
bashiwala wrote: Is there any easy way ?
Q: What is "easier" than writing 10 or 20 or 200 lines of code?
A: Getting someone else to do it for you.
led mike
|
|
|
|
|
|
What's up? I have two questions for you.
1) Why are you replying to a two and a half year old thread?
2) Why do you think I would be interested in VB code?
|
|
|
|
|
Trying to write a program that allows me to read the Product Key for windows XP.
Does anybody knows where this key is stored in the registry?
any help is greatly appreciated
|
|
|
|
|
|
thank you Guffa but I am not looking for somebody else utility.
I asked if anybody knows where the key is so I can write my own app.
|
|
|
|
|
Hi !
I am using this simple : float.Parse(MyString); where MyString is "3.4" and it works fine .. on machines with language settings set to english (!!) I have tested on a machine with french settings and I get an exception (!geee!)
Unfortunately I can not change the file I parse depending on the local machine .. Is there a way I can change the language set used by the float.parsing ?
Cheers !
Pierre
|
|
|
|
|
Use a format provider with the Parse method. To get a format provider with a period as decimal separator, you can use InvariantCulture:
float.Parse(myString, CultureInfo.InvariantCulture)
---
b { font-weight: normal; }
|
|
|
|
|
Does anyone know how or know of a website that demonstrates how to send sms messages via asp.net code without using an expensive gateway such as simplewire (they cost about 1,400/month)?
I'm not looking to bill through the cell phone (via premium SMS), I'm only looking to send out SMS text messages to users who have opted in to receive our local news & weather messages but I don't know of an affordable way to do so. At most, I would probably have no more than 10,000 SMS messages sent out per month (and even that's optimistic).
Thanks in advance.
-Goalie35
|
|
|
|
|
How can I scale up and down large(10,000*10,000) 1 bit Tiff G4 images. So far I have played with GDI+ transformations and interpolation modes but none helps quick scaling without loosing quality.It takes it more than 1 second to display such image after zoomin/zoomout.
While, Microsoft Document Imaging and IrfanView scales the same images smoothly and in less than half a second.I am willing to explore about image processing techniques, any hints/links about the same??
Thanks,
MaulikCE
|
|
|
|
|
I have to make an application to write and read structures! I have to do it in c#! I know to do this in c/c++ but i have no idea how to do it in c#!
for example, my structure is like this:
(in C)
struct Info
{
int password;
string name;
etc.
}X;
( i used File *f, fopen etc..)
how to write this into a file (*.dat) and the read them...in c#
I found this example:
http://www.codeproject.com/useritems/readwritestructstobinfile.asp
but it seems to be difficult and there are some saying that is a terrible idea!
|
|
|
|
|
Hi,
add this using statement to your code:
<br />
using System.Runtime.Serialization.Formatters.Binary;<br />
use this code to read the file:
<br />
MyClass MyObject = null;<br />
BinaryFormatter binReader = new BinaryFormatter();<br />
System.IO.Stream readStream = File.Open("c:\blah.dat", FileMode.Open);<br />
MyObject = (MyClass)binReader.Deserialize(readStream);<br />
readStream.Close();<br />
and this one to write it:
<br />
MyClass MyObject = new MyClass();<br />
<br />
BinaryFormatter binWriter = new BinaryFormatter();<br />
System.IO.Stream writeStream = File.Open("c:\blah.dat", FileMode.Create);<br />
binWriter.Serialize(writeStream, MyObject);<br />
writeStream.Close();<br />
and this is the class (or struct) you want to write to a file...
<br />
[Serializable]<br />
public class MyClass<br />
{<br />
string SomeString = null;<br />
int SomeInteger = 0;<br />
string AnotherString = null;<br />
}<br />
|
|
|
|
|
Hi everyone,
I have a new and wonderful problem I am using VS2003 and its good working but now I want to create a C# project but It isnt on File->project(when you want to start Visual studio on first page its show that) I can open exist projects(C#) but C# option isnt on project type you can see Visual Basic and Visual C++ and.. but its not show I guess maybe I remove it so I try to add/remove of install cd but again I wonderful on the CD I click on Add/Remove but in front of C# option isnt a mark button(checkbox) ("Select items to install:" all options are good except Visual C#.Net and Visual J#.Net)(I didnt this problem already)
Can you help me
Thanks
|
|
|
|
|
Have you checked out the ListBox.MultiColumn property?
---
b { font-weight: normal; }
|
|
|
|
|
It doesn't matter, i figured out how to do it with a list view, i tried to delete/edit the post a few times, but codeproject keeps crashing my browser >
Whta happens is, i come here, i try to do something (delete for example) the next page starts to load, the current browser window goes extremely slowly, all new windows go exrtremely slowly. The rest of the computer and any other previously open browser windows work fine though.
|
|
|
|
|
If you're having problems, the suggestions forum is the proper place to discus them.
|
|
|
|
|
When the page loads the dropdownlists do not display the date I want unless I press a button on the page and the page postsback to the server. I would like that date to be displayed once the page loads. Any hints?
if (Page.IsPostBack == false)
{
DateTime Yest = DateTime.Today.AddDays(-1);
string YestMonth = Yest.ToString("MMMM").Trim();
string YestDay = Yest.ToString("dd").Trim();
string YestYear = Yest.ToString("yyyy").Trim();
DropDownList2.SelectedItem.Value = YestYear.ToString();
DropDownList3.SelectedItem.Value = YestMonth.ToString();
DropDownList4.SelectedItem.Value = YestDay.ToString();
}
|
|
|
|
|
I do not see where you are inserting the values into the DropDownLists. You can not have a selected Item that does not exist in the DropDownList control. Below is the code I created, using some of your code from your question. I hope it helps.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DateTime Yest = DateTime.Today.AddDays(-1);
string YestMonth = Yest.ToString("MMMM").Trim();
string YestDay = Yest.ToString("dd").Trim();
string YestYear = Yest.ToString("yyyy").Trim();
ddlMain.Items.Insert(0, YestMonth);
ddlMain.SelectedItem.Value = YestYear.ToString();
}
}
|
|
|
|
|
The items are already inserted in design view. I am just trying to select one of those items. If I insert an item the way you want me to do it I will see duplicates of the same item in the dropdown list.
|
|
|
|
|
Not sure about dropdownlist on t'internet, but the equivelant is a combobax right?
Well even if its not
this.combobox1.SelectedItemValue = some_kinda_string;
doesn't work
this.combobox1.SelectedItem = some_kinda_string;
does work, so i guess that you want to be usin'
DropDownList2.SelectedItem = YestYear.ToString();<br />
DropDownList3.SelectedItem = YestMonth.ToString();<br />
DropDownList4.SelectedItem = YestDay.ToString();
If not, im all out of ideas.
|
|
|
|
|
Ok so it is the exact same thing minus the Insert property.
|
|
|
|
|
i have 2 forms Form1.cs and Form2.cs
i have generated mymodule.netmodule of these two using csc
now i want to generate exe from this module
i am using this command
al c:\mymodule.netmodule /t:exe /out:myexe.exe /main:Form1.Main
i have kept the form1 in the same directory where mymodule.netmodule is
(Form1 contains the main method )
but this give me the error
error AL1037: Unable to find the entry point method
'Form1.main'
|
|
|
|