Click here to Skip to main content
15,914,071 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting Started in Software Dev. Pin
jtmtv185-Feb-03 15:24
jtmtv185-Feb-03 15:24 
GeneralRe: Getting Started in Software Dev. Pin
Taka Muraoka5-Feb-03 15:35
Taka Muraoka5-Feb-03 15:35 
GeneralRe: Getting Started in Software Dev. Pin
jtmtv185-Feb-03 15:47
jtmtv185-Feb-03 15:47 
GeneralRe: Getting Started in Software Dev. Pin
Taka Muraoka5-Feb-03 15:51
Taka Muraoka5-Feb-03 15:51 
Questionhow to get all the files names in one folder? Pin
clarkwuzhe5-Feb-03 11:59
clarkwuzhe5-Feb-03 11:59 
AnswerRe: how to get all the files names in one folder? Pin
Paresh Gheewala5-Feb-03 12:30
Paresh Gheewala5-Feb-03 12:30 
AnswerRe: how to get all the files names in one folder? Pin
Paresh Gheewala5-Feb-03 13:13
Paresh Gheewala5-Feb-03 13:13 
QuestionHow to tell whether a string is a number? Pin
clarkwuzhe5-Feb-03 11:30
clarkwuzhe5-Feb-03 11:30 
AnswerRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:37
Paresh Gheewala5-Feb-03 11:37 
GeneralRe: How to tell whether a string is a number? Pin
clarkwuzhe5-Feb-03 11:39
clarkwuzhe5-Feb-03 11:39 
GeneralRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:42
Paresh Gheewala5-Feb-03 11:42 
GeneralRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:45
Paresh Gheewala5-Feb-03 11:45 
GeneralRe: How to tell whether a string is a number? Pin
clarkwuzhe5-Feb-03 11:46
clarkwuzhe5-Feb-03 11:46 
GeneralRe: How to tell whether a string is a number? Pin
Paresh Gheewala5-Feb-03 11:51
Paresh Gheewala5-Feb-03 11:51 
AnswerRe: How to tell whether a string is a number? Pin
Vasudevan Deepak Kumar5-Feb-03 17:53
Vasudevan Deepak Kumar5-Feb-03 17:53 
AnswerRe: How to tell whether a string is a number? Pin
Ian Darling5-Feb-03 23:04
Ian Darling5-Feb-03 23:04 
AnswerRe: How to tell whether a string is a number? Pin
Richard Deeming6-Feb-03 0:33
mveRichard Deeming6-Feb-03 0:33 
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
GeneralRe: How to tell whether a string is a number? Pin
Vasudevan Deepak Kumar6-Feb-03 2:22
Vasudevan Deepak Kumar6-Feb-03 2:22 
GeneralRe: How to tell whether a string is a number? Pin
Richard Deeming6-Feb-03 2:33
mveRichard Deeming6-Feb-03 2:33 
GeneralRe: How to tell whether a string is a number? Pin
Vasudevan Deepak Kumar7-Feb-03 0:11
Vasudevan Deepak Kumar7-Feb-03 0:11 
GeneralRe: How to tell whether a string is a number? Pin
Richard Deeming7-Feb-03 0:15
mveRichard Deeming7-Feb-03 0:15 
GeneralTabbing MDI childs Pin
thedex5-Feb-03 11:11
thedex5-Feb-03 11:11 
GeneralRe: Tabbing MDI childs Pin
Vasudevan Deepak Kumar6-Feb-03 2:29
Vasudevan Deepak Kumar6-Feb-03 2:29 
QuestionHow to create a control that docks and slides like the toolbox? Pin
thedex5-Feb-03 11:06
thedex5-Feb-03 11:06 
AnswerRe: How to create a control that docks and slides like the toolbox? Pin
Chris Austin5-Feb-03 13:13
Chris Austin5-Feb-03 13:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.