How to call Visual Basic .NET run-time library members from Visual C# (325961)



The information in this article applies to:

  • Microsoft Visual C# 2005, Express Edition
  • Microsoft Visual C# .NET (2002)

This article was previously published under Q325961

SUMMARY

This step-by-step article describes how to use the members that are provided by the Microsoft Visual Basic .NET run-time library in a Visual C# application.

back to the top

Add a Reference to the Visual Basic .NET Run-Time Library

  1. In a Visual C# application, click the Project menu, and then click Add Reference.
  2. In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
  3. At the top of the source file, add the following statement:
    using Microsoft.VisualBasic;
    					
back to the top

Sample Code

You can now use members of the Visual Basic .NET run-time library in Visual C#. The following code demonstrates how to use the IsNumeric function, which is a member of the Microsoft.VisualBasic.Information class:
private void UseIsNumeric()
{
     string s = "123";
     bool bResult1, bResult2;
     bResult1 = Information.IsNumeric(s);
     // bResult1 now equals true
     s = "Hello";
     bResult2 = Information.IsNumeric(s);
     // bResult2 now equals false
}
				
back to the top

REFERENCES

For additional information about Visual Basic .NET run-time library functions, methods, and properties, see "Visual Basic Run-Time Library Members" in the Microsoft Visual Studio .NET documentation.

back to the top

Modification Type:MajorLast Reviewed:1/18/2006
Keywords:kbHOWTOmaster KB325961 kbAudDeveloper