Visual Studio Option Compare

I apologize in advance for any nomencalture or verbiage that makes no sense.

From what I understand, in Visual Studio 2010 default settings...

In VB if I do this

If "LBrister" = "lbrister" Then
   Return True
Else
   Return False
End If

I should get False?


And if I change my settings in Tools Options (Screen Print) for Options Compare
From Binary
To Text

The above VB should return True?

My real question...
On application build...will that still hold true...
In other words, does the Option Compare go with the build?

sc
Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

UnifiedISCommented:
I don't think that setting will affect a string comparison, it will return false after compile
0
UnifiedISCommented:
I stand corrected, if I read this correctly, both binary and text options will allow the compare to return a true

Put your Option Compare setting as the first line in your class

From MS:
http://msdn.microsoft.com/en-us/library/8t3khw5f.aspx

 Binary
      

Optional. Results in string comparisons based on a sort order derived from the internal binary representations of the characters.

This type of comparison is useful especially if the strings can contain characters that are not to be interpreted as text. In this case, you do not want to bias comparisons with alphabetical equivalences, such as case insensitivity.

Text
      

Optional. Results in string comparisons based on a case-insensitive text sort order determined by your system's locale.

This type of comparison is useful if your strings contain all text characters, and you want to compare them taking into account alphabetic equivalences such as case insensitivity and closely related letters. For example, you might want to consider A and a to be equal, and Ä and ä to come before B and b.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Larry Bristersr. DeveloperAuthor Commented:
UnifiedUS,
  Does that mean that if I have a Function like below
And pass in HookSwitch

After compile I get
MessageTypes.Unhandled

  Public Function SendProcStatus(ByVal inbStream As String) As MessageTypes
        Select Case inbStream
            Case "ServiceInitiated"
                Return MessageTypes.ServiceInitiated
            Case "Originated"
                Return MessageTypes.Originated
            Case "Delivered"
                Return MessageTypes.Delivered
            Case "Established"
                Return MessageTypes.Established
            Case "NetworkReached"
                Return MessageTypes.NetworkReached
            Case "Diverted"
                Return MessageTypes.Diverted
            Case "PrivateEvent"
                Return MessageTypes.PrivateEvent
            Case "Held"
                Return MessageTypes.Held
            Case "Retrieved"
                Return MessageTypes.Retrieved
            Case "Transferred"
                Return MessageTypes.Transferred
            Case "Queued"
                Return MessageTypes.Queued
            Case "Hookswitch"
                Return MessageTypes.HookSwitch
            Case "DoNotDisturb"
                Return MessageTypes.DoNotDisturb
            Case "ConnectionCleared"
                Return MessageTypes.ConnectionCleared
            Case "MonitorStartResponse"
                Return MessageTypes.MonitorStartResponse
            Case "Failed"
                Return MessageTypes.Failed
            Case Else
                Return MessageTypes.Unhandled
        End Select
    End Function

Open in new window

0
UnifiedISCommented:
Did you put "option Compare Binary" at the top of the code above the class declaration?

Option Compare Binary
public class...

Another option would be to force the string to an upper case and then compare

Change the select to:
 Select Case inbStream.ToUpper

Then make all your case statements use the upper case as well.
case "HOOKSWITCH"
0
Larry Bristersr. DeveloperAuthor Commented:
That works fine.
The link pointed out that in the Project Properties you can set the Option COmpare in the Complie pane
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.