|
Try taking a look on sourceforge for something that takes your fancy.
There are always organizations around that need people to help out even if it's not necessarily computer-related. You can boost your CV *and* do something socially useful at the same time
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
NEW: Awasu v0.7[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
whats the address for souce forge? (http://www.sourceforge.com) ? thanks alot for the usefull info
The Code Project Is Your Friend...
|
|
|
|
|
It's actually sourceforge.net but either one will work.
welcome to the wunnerful world of open source...
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
NEW: Awasu v0.7[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
say you pick one files in the openfiledialogue window. how can u get all the files names in a string array?
|
|
|
|
|
using System;
using System.IO;
using System.Collections;
// Takes an array of file names or directory names on the command line.
// Determines what kind of name it is and processes it appropriately
public class RecursiveFileProcessor {
public static void Main(string[] args) {
foreach(string path in args) {
if(File.Exists(path)) {
// This path is a file
ProcessFile(path);
}
else if(Directory.Exists(path)) {
// This path is a directory
ProcessDirectory(path);
}
else {
Console.WriteLine("{0} is not a valid file or directory.", path);
}
}
}
// Process all files in the directory passed in, and recurse on any directories
// that are found to process the files they contain
public static void ProcessDirectory(string targetDirectory) {
// Process the list of files found in the directory
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string fileName in fileEntries)
ProcessFile(fileName);
// Recurse into subdirectories of this directory
string [] subdirectoryEntries = Directory.GetDirectories(targetDirectory);
foreach(string subdirectory in subdirectoryEntries)
ProcessDirectory(subdirectory);
}
// Real logic for processing found files would go here.
public static void ProcessFile(string path) {
Console.WriteLine("Processed file '{0}'.", path);
}
}
This program will allow you to select all the files and subdirectory
once you pass the folder name
Paresh
|
|
|
|
|
you could find your solutions also at
http://www.gotdotnet.com/Community/MessageBoard/MessageBoard.aspx?ID=6
thanx
Paresh;P
|
|
|
|
|
Is there anything like isnumber("1")=true?
or something else?
thanks
|
|
|
|
|
string s = "1";
int n = Convert.ToInt32(s);
Paresh
|
|
|
|
|
however,
string s="a";
int n=Convert.toint32(s);
will give an error, won't it? there must be a way to tell...
|
|
|
|
|
|
if you want comparision
then
string s = "1";
if (s.CompareTo("1") == 0 )
{
// blah
}
Paresh
|
|
|
|
|
i found a discussion here:
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20391710.html
but i really can't believe this language leads to such a pain in the a$$
|
|
|
|
|
see, i just gave u the temp. working solution. i believe there are tons of solution for this type of problem
u could check char.by char.,
regex, string - try-catch method, int.parse, etc...
Paresh
|
|
|
|
|
Use this:
public static bool IsNumber(string strNumber)
{
Regex objNotNumberPattern=new Regex("[^0-9.-]");
Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*");
Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*");
String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
String strValidIntegerPattern="^([-]|[0-9])[0-9]*$";
Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")");
return !objNotNumberPattern.IsMatch(strNumber) &&
!objTwoDotPattern.IsMatch(strNumber) &&
!objTwoMinusPattern.IsMatch(strNumber) &&
objNumberPattern.IsMatch(strNumber);
}
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
If this was VB.NET, you could use IsNumeric, so you could wrap that up in a class that is callable from C#.
Another C# approach would probably be to check each character in the string with IsDigit or IsNumber, or maybe use something similar to the following.
string s="1234";<br />
bool b = s.Trim("1234567890".ToCharArray()).Equals("");
--
Ian Darling
|
|
|
|
|
Here's the C# equivalent of VBs IsNumeric function:
using System;
using System.Globalization;
public class Conversion
{
private static bool IsNumericTypeCode(TypeCode t)
{
switch (t)
{
case TypeCode.Boolean:
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.Int16:
case TypeCode.UInt16:
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
case TypeCode.Decimal:
return true;
default:
return false;
}
}
public static bool IsNumeric(object expression)
{
string sExp = null;
IConvertible conv = expression as IConvertible;
if (null == conv)
{
if (null == expression as char[])
return false;
sExp = new string((char[])expression);
}
else
{
TypeCode t = conv.GetTypeCode();
if (IsNumericTypeCode(t))
return true;
else if (t == TypeCode.String || t == TypeCode.Char)
sExp = conv.ToString(null);
}
if (null == sExp)
return false;
else
return IsNumeric(sExp);
}
public static bool IsNumeric(string expression)
{
if (null == expression || 0 == expression.Length)
return false;
else
{
double d;
return double.TryParse(expression,
NumberStyles.Any, null, out d);
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
That's cool function, Richard!!!
But wait!! I have one doubt... Sometimes C# Compiler shouts if I forget to put a break stating
'Control can not fall through...'
but here in this code snippet, you have said return true for multiple case options and it has compiled.
How?
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
The C# compiler is able to determine that any code after the return statement is unreachable, so execution could never fall through. If you add the break statements after the return statements, you'll see unreachable code warnings when you compile.
From the C# language reference:
The statement list of a switch section typically ends in a break, goto case, or goto default statement, but any construct that renders the end point of the statement list unreachable is permitted. For example, a while statement controlled by the Boolean expression true is known to never reach its end point. Likewise, a throw or return statement always transfers control elsewhere and never reaches its end point.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi Richard,
Pl. see here:
switch (x)
{
case 1:
x =4;
break;
case 2:
case 3:
x = 5;
break;
default:
Console.Write("dog");
}
The compiler reports
C:\deepak\test.cs(31): Control cannot fall through from one case label ('default:') to another
What is the actual cause?
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
The end-point of your default case is reachable, since it doesn't end with a jump statement (break, return, goto, etc.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Does anybody know how to show the childs as tabbed documents in an MDI application?
Thanks
|
|
|
|
|
|
Hi,
Does anybody know how to make a MDI child dock (or a control from a windows control library) and slide like the toolbox?
Thanks
|
|
|
|
|
|
Newbie Simple question, I can change a textbox ForeColor, BackColor so that say the text is Blue,
But how do I do the same to the datetimepicker?
Although the properties are hidden, they can be changed but they make no difference to the form.
Thanks
Steve Graham
|
|
|
|