Export (0) Print
Expand All

Operators.CompareString Method

Note: This method is new in the .NET Framework version 2.0.

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Performs binary or text string comparison given two strings.

Namespace: Microsoft.VisualBasic.CompilerServices
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)

public static int CompareString (
	string Left,
	string Right,
	bool TextCompare
public static int CompareString (
	String Left, 
	String Right, 
	boolean TextCompare
public static function CompareString (
	Left : String, 
	Right : String, 
	TextCompare : boolean
) : int



The first string to compare.


The second string to compare.


A bool value specifying whether or not to use text comparison. If True, uses text comparison; if False, uses binary comparison.

Return Value

An integer value. Returns 0 if the strings do not match.

For more information, see Like Operator and Option Compare Statement.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft