Re: IsNumeric



Hi sck10,

Thank you for your quick reply.

Here's the steps to get the source code of IsNumeric:

1) Create a simple VB.NET console application, type in following code:

Sub Main()
Dim s As String = "1.234"
If IsNumeric(s) Then
Console.WriteLine("s is numeric")
End If
s = "2006/9/1"
If IsDate(s) Then
Console.WriteLine("s is date")
End If
End Sub

2) Build it; in Reflector, open the generated exe; find the Main function,
double click it to see its disassembled code (make sure you selected "C#"
in the toolbar combobox):

[STAThread]
public static void Main()
{
string text1 = "1.234";
if (Versioned.IsNumeric(text1))
{
Console.WriteLine("s is numeric");
}
text1 = "2006/9/1";
if (Information.IsDate(text1))
{
Console.WriteLine("s is date");
}
}

3) Click on the "IsNumeric" function to navigate to its source. You will
learn that it's located in Microsoft.VisualBasic.CompilerServices.Versioned
as a static method, so you can reference Microsoft.VisualBasic.dll in your
C# project and use this method directly; or you can write your version of
IsNumeric use the disassembled code as reference.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • RXParse module v.91 (by robic0)
    ... # Unicode character reference ... sub original_content ... then call content handler with $content ...
    (comp.lang.perl.misc)
  • Re: Emailing a Report
    ... make sure you have a reference to a Microsoft DAO Library ... The Sub LoopAgmtsSendEmail is highlighted by the Debugger. ... 'pSQL -- defines the recordset to open ... You must remember to enclose literal values in quotes and concatenate them; the final string must have commas too, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Please help me clarify these byVal vs. byRef subtleties
    ... ByVal & ByRef Parameters are independent of Reference & Value Types. ... > I've got a class, DataHider, with one private string field (i.e., ... > Public Sub callObjectMethodPassedByVal(ByVal myObj As ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Shared Method Problem With "Global" Storage
    ... a routine in Module1 which then calls code back in Form1 ... ButtonHasBeenClicked but the reference to ButtonHasBeenClicked ... instance member of a class from within a shared method or shared ... In a shared Sub, you can not access an instance field withouth ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Auto Load Add-In
    ... you posted that will unload the addin. ... Sub ListAddins() ... Dim adn As AddIn ... I also assume the reason you want to add a project reference to the addin to ...
    (microsoft.public.excel.programming)