|
Not at all. It's a simple means where you do not have to worry about null/DBNull conversion in code.
Regards,
Rob Philpott.
|
|
|
|
|
Hi Guys. I have written a Windows Service with a FileWatcher. Now, when there are new files in the directory it picks the files up fine but when it has to copy then out into a new directory I get an error of The given path's format is not supported . Below is the copy function.
try
{
string path = fsw.Path;
string outPath = "C:\\TestDir2\\";
char[] trimchars = new char[] { '.', 't', 'x', 't' };
DirectoryInfo dinfo = new DirectoryInfo(path);
foreach (FileInfo finfo in dinfo.GetFiles("*.*"))
{
File.Copy(finfo.FullName, outPath + finfo.FullName, true);
}
}
It stops on the line: FIle.Copy(finfo.FullName, outPath + finfo.FullName, true); . Anybody have any ideas?
Excellence is doing ordinary things extraordinarily well.
modified on Friday, June 12, 2009 8:26 AM
|
|
|
|
|
Did you debug to see what is the value in the variables and are they similar to what is expected as Copy params?
By the way what is the error? do you get an exception. If yes, which one?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Yes, I have debugged it and low and behold, I missed it, should not have used outPath + finfo.FullName , should have used outPath + finfo.Name .
Silly mistake.
Thanks anyway.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Help others by editing your original post add [solved] to the title and at the end anotate the solution.
There are those of flamable nature who might jump at a silly mistake, we all make them, so pre-empt them by telling them.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Happiness?? Never seen anybody else do that!!
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Thanks. Your original was, as I said, a bit of a silly mistake and in that scenario it is better to tell others that you have realised what you did wrong.
If everyone would mark the thread headers with the solutions the forums would be easier to follow.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I did that in my reply. I mentioned exactly what I did wrong and rectified it.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
I have the following code
StreamReader sr = new StreamReader(strMainPath);
string allRead = sr.ReadToEnd();
sr.Close();
regMatch = textBox1.Text;
if (Regex.IsMatch(allRead, regMatch))
{
richTextBox1.Find(regMatch);
richTextBox1.SelectionColor = Color.Red;
richTextBox1.SelectionBackColor = Color.Yellow;
}
from textBoxi.text i am getting the word to search.
It is searching and getting the result, if that word is there
it highlighed.But my problem is to focus on that text in text area.
If the file is very large ,i have to scroll to findout where is the highlighted text.Instead of that i want to focus on that text.
Is there any way?
Pls help
|
|
|
|
|
Hi,
have a look at ScrollToCaret().
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Damned you Luc!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Chill out you bloody Hungarian.
Did it really take you three minutes to type those two sentences?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Yes it bloody did!
I had to do lots of copy/paste scroll test stuff. I don't just make these answer up off the cuff you know. Research is the answer. And Gin. Never underestimate Gin.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Nagy Vilmos wrote: I don't just make these answer up off the cuff
I believe you. Well. Most of the time I do.
Nagy Vilmos wrote: Research is the answer.
Sure it is. I did appreciate your latest research report[^].
FWIW: I tend to perform my research in advance, those three minutes may prove to be very critical.
Nagy Vilmos wrote: Never underestimate Gin.
Gin is fuel, it is essential, couldn't do without; it is not an excuse for a slow down.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
use the ScrollToCaret() method to scroll to the current cursor position.
BTW Is the file content in allRead copied into richTextBox1 ? You do know that you can load a file directly into the control?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi all,
When i open my windows ce application in device the wifi is disconnected automatically.
before opening the app(in constructor) the application is actually retriving the data from the xml file(web call) storing it into hashtable object.i did not get why wifi is disconnecting in the device.
Do anybody have idea what is the wrong?
Thanks.
|
|
|
|
|
Hi,
You should post this in the Mobile Development section.
You need to contact your device manufacturer to obtain an SDK or utility for that device.
Regards
Mick Curley
|
|
|
|
|
Hi,
How to print a document directly without showing print dialouge.
Eg. When i click a button, a document in a given path should print directly without showing print dialouge .
Thankyou
YPKI
|
|
|
|
|
Generally, that should be possibile. How, this depends by the document type.
What type of document you are trying to print?
|
|
|
|
|
for example: bill or any thing in a small piece of paper
|
|
|
|
|
Hi to all.
I am developing an IE toolbar.
Now I need to know if there is any way to identify status of my Toolbar. i.e. Is My toolbar is enable/disable in IE Which event will fire when Toolbar is disable/enable by user.
Please Help Me.
|
|
|
|
|
I was going to have a go for reposting, but I see you haven't had any replies at all.
You may be better off asking someone directly who may know the answer such as the author of this[^] article.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi Guys, Firstly let me say this, this code is to be used to remove a virus.
Please could anyone help me with the following code, I cant access the network. It is not a permissions error. I cant map all the locations to my drrive either.
using System;
using System.IO;
namespace Delete
{
class Program
{
public static void Main(string[] args)
{
string Slashes = @"\\";
string NetPath = "PCName";
string path = Slashes + NetPath + "\\c:\\temp\\Test.txt";
Console.WriteLine(path);
Console.ReadLine();
try
{
using (StreamWriter sw = File.CreateText(path)) {}
string path2 = path + "temp";
File.Delete(path2);
Console.Write("Press any key to continue . . . ");
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
Console.ReadLine();
}
}
}
}
the error I ge says
\\istec015\c:\windows\Test.txt
The process failed: System.NotSupportedException: The given path's format is not
supported.
Please can soneone help
|
|
|
|
|
paolo.gigante wrote: this code is to be used to remove a virus.
How is this code going to remove a virus?
Anyway
c: in your path is what's wrong.
You can only access shared maps / drives over network and those normally don't have the ':' in it
|
|
|
|
|
I know the exact location of the files.
Is there any way I can do this without mapping the drives? I have over 2000 PCs that this has to browse to.
|
|
|
|