Some VBScript functions are not implemented in C#. So when ASP2ASPX converts VBScript functions to C#, maybe Microsoft.VisualBasic.dll
is still required. In this case, please reference Microsoft.VisualBasic.dll to your ASP.NET Project.
Please
see following table that lists VBScript and C# codes:
VBScript 5.6 Functions | C# code |
Abs | System.Math.Abs |
Array | new Object() { } |
Asc, AscB, AscW | (short)string[0], byte(string[0]), (int)string[0] |
Atn | System.Math.Atan |
CBool | System.Convert.ToBoolean |
CByte | System.Convert.ToByte |
CCur | System.Convert.ToDecimal |
CDate | System.Convert.ToDateTime |
CDbl | System.Convert.ToDouble |
Chr | (char) |
CInt | System.Convert.ToInt32 |
CLng | System.Convert.ToInt64 |
Cos | System.Math.Cos |
CreateObject | CreateObject or new instance in .NET |
CStr | System.Convert.ToString |
Date | System.DateTime.Today |
DateAdd | Microsoft.VisualBasic.DateAndTime.DateAdd |
DateDiff | Microsoft.VisualBasic.DateAndTime.DateDiff |
DatePart | Microsoft.VisualBasic.DateAndTime.DatePart |
DateSerial | new DateTime() |
DateValue | Microsoft.VisualBasic.DateAndTime.DateValue |
Day | System.DateTime.Day |
Eval | * |
Exp | System.Math.Exp |
Filter | Microsoft.VisualBasic.Strings.Filter |
Fix | (int) |
FormatCurrency | Microsoft.VisualBasic.Strings.FormatCurrency |
FormatDateTime | Microsoft.VisualBasic.Strings.FormatDateTime |
FormatNumber | Microsoft.VisualBasic.Strings.FormatNumber |
GetLocale | Session.LCID |
GetObject | Microsoft.VisualBasic.Interaction.GetObject |
GetRef | (Does not support) |
Hex | Int32.ToString("X") |
Hour | System.DateTime.Hour |
InputBox | Microsoft.VisualBasic.Interaction.InputBox |
InStr, InstrB | System.String.IndexOf |
InStrRev | System.String.LastIndexOf |
Int | Microsoft.VisualBasic.Conversion.Int |
IsArray | Microsoft.VisualBasic.Information.IsArray |
IsDate | Microsoft.VisualBasic.Information.IsDate |
IsEmpty | Microsoft.VisualBasic.Information.IsEmpty |
IsNull | System.Convert.IsDBNull |
IsNumeric | Microsoft.VisualBasic.Information.IsNumeric |
IsObject | * |
Join | System.String.Join |
LBound | Microsoft.VisualBasic.Information.LBound |
LCase | System.String.ToLower |
Left, LeftB | System.String.Substring(0,..) |
Len, LenB | System.String.Length |
LoadPicture | * |
Log | System.Math.Log |
LTrim | System.String.TrimStart |
Mid, MidB | System.String.Substring |
Minute | System.DateTime.Minute |
Month | System.DateTime.Month |
MonthName | Microsoft.VisualBasic.DateAndTime.MonthName |
MsgBox | Microsoft.VisualBasic.Interaction.MsgBox |
Now | System.DateTime.Now |
Oct | System.Convert.ToString(Number, 8) |
Replace | Microsoft.VisualBasic.Strings.Replace |
RGB | Microsoft.VisualBasic.Information.RGB |
Right, RightB | System.String.Substring |
Rnd | Microsoft.VisualBasic.VBMath.Rnd |
Round | System.Math.Round |
RTrim | System.String.TrimEnd |
ScriptEngine | * |
ScriptEngineBuildVersion | * |
ScriptEngineMajorVersion | * |
ScriptEngineMinorVersion | * |
Second | System.DateTime.Second |
SetLocale | * |
Sgn | System.Math.Sign |
Sin | System.Math.Sin |
Space | new String(' ',...) |
Split | Microsoft.VisualBasic.Strings.Split |
Sqr | System.Math.Sqrt |
StrComp | System.String.Compare |
String | new String() |
StrReverse | Microsoft.VisualBasic.Strings.StrReverse |
Tan | System.Math.Tan |
Time | System.DateTime.Now.TimeOfDay |
Timer | System.DateTime.Now.TimeOfDay.TotalSeconds |
TimeSerial(hour, minute, second) | new TimeSpan(hour, minute, second) |
TimeValue | Microsoft.VisualBasic.DateAndTime.TimeValue |
Trim | System.String.Trim |
TypeName | Microsoft.VisualBasic.Information.TypeName |
UBound | Microsoft.VisualBasic.Information.UBound |
UCase | System.String.ToUpper |
VarType | Microsoft.VisualBasic.Information.VarType |
Weekday | Microsoft.VisualBasic.DateAndTime.Weekday |
WeekdayName | Microsoft.VisualBasic.DateAndTime.WeekdayName |
Year | System.DateTime.Year |
* Don't support the function