|
Not if the OP's using @"\", which the OP is.
|
|
|
|
|
I see. My bad. But I'd still use the PathSeparator
Standards are great! Everybody should have one!
|
|
|
|
|
Sorry, PathSeperator didn't help.
I have also tried using MoveTo as that only requires the destination. All I get is 'Could not find a part of the path'
but having added together the variables and written them to the page all seems fine - I can only think it can't find it because it doesn't exist yet, but surely that would be silly right?
|
|
|
|
|
That code should work, there is nowt wrong with it.
Try hardcoding the path into your code rather than getting it from textFields for debugging.
|
|
|
|
|
Try using Path.Combine() to build the path too.
|
|
|
|
|
have tried hard coding it and it works fine.
OK I'll keep searching
thx
|
|
|
|
|
Just a suggestion yyou don't need to use 'ToString()' on the fileinfo.Name <-it is a string
Are you sure the when you call the File.Move() the correct param are being passed?
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Try this:
String ParentDir = textfield1.Text;
String ChildDir = textfield2.Text;
DirectoryInfo di = new DirectoryInfo(Path.Combine(Path.Combine("C:\\", ParentDir), ChildDir));
foreach (FileInfo fileinfo in di.GetFiles())
{
String newdirectory = Path.Combine("C:\\", ParentDir);
//new file name is same as one found
String newfilename = fileinfo.Name;
String Newdirandname = Path.Combine(newdirectory, newfilename);
File.Move(fileinfo.FullName, Newdirandname);
}
|
|
|
|
|
ok, as suggested i removed 'ToString()' - that was mainly added due to frustration.
String ParentDir = textfield1.Text;
String ChildDir = textfield2.Text;
DirectoryInfo di = new DirectoryInfo(@"c:\"+ParentDir+@"\"+ChildDir+@"\");
foreach (FileInfo fileinfo in di.GetFiles())
{
String newdirectory = @"c:\"+ParentDir+@"\";
//new file name is same as one found
String newfilename = fileinfo.Name.ToString();
//String Newdirandname = newdirectory + newfilename;
//File.Move(di+fileinfo.Name, Newdirandname);
fileinfo.MoveTo(Path.Combine(newdirectory, newfilename));
//I have changed this to be fileinfo.MoveTo() to avoid passing the wrong parameter but I still get the same message. I also tried the Path.Combine() method but it didn't change anything
I think I have tried testing everything now and it all comes back to the same result.
}
|
|
|
|
|
OK success!
I have added Path.Combine to everything (everything that needed it!)
and it seems to have worked.
However this was a simplified version, I now have to make it a bit more complicated, but I know it works so thanks for all your help, that was great.
Mark
|
|
|
|
|
This line seems to be the problem. You need to change:
markymark82 wrote: File.Move(di+fileinfo.Name, Newdirandname);
into
File.Move(fileinfo.FullName, Newdirandname);
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I have been trying to override System.Windows.Forms.Form's Dispose(bool disposing) method, in order to release the resources held by my form.
However, when I type "override <spacebar>" VS displays a list with overridable items, but it does not include the Dispose(bool disposing) method.
In an earlier post of mine[^], I was instructed to use the form's events to dispose of the resources.
But why not use the dispose pattern if its already implemented by System.Windows.Forms.Form?
And what is the reason for VS not to show the Dispose(bool disposing) method in the list?
Thanks in advance,
Shy.
|
|
|
|
|
You don't need to override the Dispose method, just implement the IDisposable interface and the Dispose method will be called automatically. Since it's not an override it doesn't show up in the code completion feature.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi!
I'm saving images in png format from a tiff file. But only sometimes following error occurs.
A generic error occurred in GDI+.<br />
System.Runtime.InteropServices.ExternalException: A generic error occurred<br />
in GDI+.<br />
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,<br />
EncoderParameters encoderParams)<br />
at System.Drawing.Image.Save(String filename, ImageFormat format)
Its a windows application.
I've cross checked for the permission etc.
But after lots of Googling I've only got to know that permission issue which is not there in my case. Please reply, it is giving me lots of headaches.
Thanks in advance.
Don't Quit
|
|
|
|
|
Yes, it is a known weakness of GDI+: almost all kinds of failure result in
"A generic error...". My advice is twofold:
1) look carefully at the line numbers that Visual normally shows in its traceback
when a program fails while running from inside Visual Studio. This should tell you
exactly where it fails. (If not, try single stepping).
2) assuming it fails in Image.Save(arg1, arg2, ...) output each of the args to make
sure they are all correct (there may be problems with double slashes/backslashes,
relative vs absolute paths, etc). If all args are correct, check for file already exists,
file is locked, and such things. I suggest you add code to do all that until you
found what is causing your trouble (then you may remove it, or leave it in the catch
that now no longer fires).
BTW: some questions you may ask yourself: does it always succeed the first time ?
does it always fail the second time ? are multiple threads involved, if so could
they overlap their image operations ?
Luc Pattyn
|
|
|
|
|
Thanks Luc for your reply! I will check out everything as told by you.
Don't Quit
|
|
|
|
|
Dear all,
I am trying to clear the cache in webbrowser control, I have used the sample code given in the MSDN. But it is clearing the whole cache.. How to clear the known cache entry..i.e i know the URL entry that needs to be removed from cache. the problem is iam directing Webbrowser control to change password screen when user presses ChangePwd button, once he logged in to page, every time when user clicks chnage pwd button it shows the Change Pwd page, instead of login page.
I tried one more solution, like everytime i am diposing the webbrowser control and loading it again, but that also doesn't clear the cache. but if you open the same URL in IE it is going correctly(mean login page instead of change pwd page)
Thanks
Srini
|
|
|
|
|
Hello,
I have a setup project for my app, which installs some shortcuts in the User's Programs Menu.
I want these shortcuts to have icons, but I couldn't find a way to attach an icon to them without adding the .ico file to the installation directory.
Is it possible to somehow use icons embeded within other files?
Thanks in advance,
Shy.
|
|
|
|
|
Icons can be embedded as resources within a project.
Add you icon files as resources to the project, then right-click them, choose the properties and set the Build Action to Embedded Resource
SkyWalker
|
|
|
|
|
hi all
I need to create Report(like Crystal Report but not Using Crystal report S/w ) in HTML
Can anyone help me plz
thanks for y'r time
|
|
|
|
|
i'm currently working on the same topic, but how are u making crystal reports on html???
html based reports are static reports i.e. suppose u created a report today. added more data to ur database after creating report, this report will not have the current data after updating the database table.
so, for showing currently updated data,dynamic/crystal reports are needed. i'm using the approach to write reports through the StreamWriter class.
first create a '.cs' file that contains all items or variables which are going to be displayed on the report. Create another '.cs' file that contains the items of a form in C# plus the event handler that has the query to select all records, so whenever this event occurrs, the query is called and the current data is fetched from the db. Create a project file, Assembly file and then run these files in VS.Net.
Voila, crystal reports are made.
if u don't fully understand the idea or approach i'm using, do tell.
Saira
|
|
|
|
|
|
i am Taking abt Crystal Report , I am Taking on HTML based Report for details of HTML Rrport Plz login to following site and see how it's work
http://crm.tustena.com/
User: ganesh@eway-software.com
Password: 27lfq0yf
http://crm.tustena.com/CRM/QBDefault.aspx?m=55&dgb=1&si=42[^]
thank's alot's
|
|
|
|
|
I used menubar control.
There is edit menu that contains cut,copy paste option.
without coding How can I used the cut,copy and paste opration.
Is there any other solution for that.
Thanks
|
|
|
|
|