|
You need to escape the characters like \. Try changing this to \\ or put @ symbol before starting string.
|
|
|
|
|
\d\[\s].?\d[[\s]
for getting folating point value
with regards
nicholas.R
<nichdomni@rediff.com>
|
|
|
|
|
Nicholas.R wrote: \d\[\s].?\d[[\s]
This is wrong.
|
|
|
|
|
Well, how about using Double.TryParse[^]?
string str = floatTextBox.Text;
double val;
if (Double.TryParse(str, out val))
{
}
else
{
}
|
|
|
|
|
I would use the Double.TryParse method, as suggested. If you really must use a Regex:
^[+-]?\d+\.?\d*$
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
How to copy all files from one folder to another at a time in C#.net
|
|
|
|
|
use
System.IO
FileInfo Class , and File.Copy() method .
Hope this hits will help you
|
|
|
|
|
file.copy only copies one file but i want to copy all files in a folder to another folder at a time
|
|
|
|
|
Hi,
this is also easy to do:
foreach(string file in System.IO.Directory.GetFiles(path))
{
File.Copy(....);
}
|
|
|
|
|
You have got the answer
|
|
|
|
|
Hi,
I got the answer . Thank u
I Modified the code a little :
DirectoryInfo df = new DirectoryInfo(@"C:\Inetpub\wwwroot\Sample\images");
foreach(FileInfo f in df.GetFiles())
{
string p = f.FullName.Replace("images", "New Folder");
File.Create(p);
}
|
|
|
|
|
ysunil_74 wrote: string p = f.FullName.Replace("images", "New Folder");
File.Create(p);
That just creates an empty file in a different location and will also cause interesting side effects if the filename has the string "images" in it.
|
|
|
|
|
ysunil_74 wrote: but i want to copy all files in a folder
What prevents you from iterating through the list of files returned through .GetFiles() ?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
What's the best way to update/Refresh PropertyGrid control on Form1.cs when differnt kinds of obejects are create through a middleTier class. I mean right now I declared like this
public static PropertyGridControl pg = new PropertyGridControl
I am updating through global or static reference in my classes when objects properites are changed or created. I don't want to use this global referench as there any better or elegant way. Can some plz demonstrat in a few examples or any helpful links
thanks
|
|
|
|
|
I appreciate your post but it didn't answer my question yet.
I'll be more specific, I'll tell you exactly what I've already done and what else needs to be done.
(if it's necessary: I use VS 2008)
I created a solution named "Shehakim".
in this solution I added two projects:Windows application named "Shehakim" and ASP.NET Web Service Application named "AppSevices".
in the AppServices project I configured roles and users etc. at VS Menu>Projects>ASP.NET Configuration.
then in Project Properties>Web>Servers>UseVS...>I chose the deployment destination of the service to port 55438 and Virtual path /AppServices.
then,
in the "Shehakim" project properties>Services I chose "Use Forms Authentication" and I supplied this address in the fields: http://127.0.0.1:55438/AppServices.
now,
what I want to do is to create a login form (A windows based form) in the AppServices project so I can call this form from many applications, and causing the "Shehakim" project react correspondingly to the users authorization in the AppService.
thank you so much for your time!
Shimi
modified on Wednesday, January 16, 2008 3:01:36 AM
|
|
|
|
|
I am attempting to determine at run time what the maximum file size is that can be written to a particular location (for example, if using FAT32 file system: ulong maxFileSize = Math.Min(4GB, AvailableDiskSpace)). I am currently able to find how much disk space is remaining using the WinAPI call 'GetDiskFreeSpaceEx', but I cannot figure out how to get the max file size. So far, my only thought is to make a call to the WinAPI method 'GetVolumeInformation', then take the resulting file system, and do a table lookup to discover this max size. Can anyone either (1) inform me of a better way of doing this, so I don't have to rebuild anytime a new file system comes out, or (2) let me know the strings that can currently be returned by 'GetVolumeInformation' so I can lookup as many different FS as possible? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi Jeff,
first of all, I don't know. I do have some code that tries to clear a small partition (FAT)
by writing then deleting one new big file, but occasionally this throws an error,
probably because the new directory entry itself may need an extra sector (or even cluster).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Yeah, I havn't found anything either. I just went to Wikipedia and copied a bunch of file systems they had listed with max file sizes, then made a switch statement checking if the string matched any of those names. I know I have the big ones for windows (since 95), which presumably will prove to be sufficient since I am using the WinAPI to get the values. Anyway, if you or anyone else comes up with a better way, please let me know. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
I have a simple question. How can I find out if a drive is local or mapped and if network mapped what the actual network mapping is? I am using a FolderBrowserDialog to retrieve the path string and need to make sure the path is converted to actual path and check to see if the path is on a removeable device, local hard drive, or network path. I used to be able to this in C++ with API calls (it has been years since I tried), and C++ is not C#.
Thanks,
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
You can invoke API calls with C#.
|
|
|
|
|
Hello
I have a datacolumn that uses an expression to sum other columns, for example i have 3 datacolumns: count1, count2 and count3.
A 4th column "total" uses the expression:
"IsNull([count1],0) + IsNull([count2],0) + IsNull([count3],0)"
Which works fine if any one column value in the row is null. However if all 3 columns have null values, the 4th column will be 0. I want it to be null. See example below.
|count1|count2|count3|total|
| 3| 2| 5| 10|
| 12| | 3| 15|
| | | | 0|
for that last row i would like the total value to be blank rather than 0. How can I achieve that in the expression?
thanks
Yann
|
|
|
|
|
I found the solution
expression should be:
IIF(IsNull(Count1, -1) = -1 and IsNull(Count2, -1) = -1 and IsNull(Count3, -1) = -1, null, IsNull([count1],0) + IsNull([count2],0) + IsNull([count3],0))"
the first part of the IIF statement checks that all 3 count columns are null and returns -1 if they are. If all three conditions are true then the expression evaluates to null. Otherwise it totals up the value.
Yann
|
|
|
|
|
There is a much more simple way to do this. Do your math, and if it equals 0, set the last column to DBNull.Value
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I have a variable which contains file path called filename and I use this variable to start a process like this: Process proc = Process.Start(filename); If I pass path to a text file then everything work well, but if I create a shortcut for that text file and use it to start a new process, the return value is null. Why does it happen? Apart from that for some executable files the return value is also null. I've checked msdn and according to it null is returned when there already exists same process but it's not the case.
How can I retrieve the process started in this way if the return value is null? Do I have to use winapi?
Thanks
|
|
|
|
|
Not every process returns a value either.
Launching a shortcut just doesn't return a value. You can launch the .EXE, or whatever document, directly and get the return value (if there is one!), but launching through a shortcut drops the return value.
There is no way to retrieve the return value if the one you get back is null .
|
|
|
|