Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use --> OR in c#
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01175341
Message ID:
01175362
Views:
6
>Hi Fred,Thanks for your reply.
>
>Tried the single quote but getting the same error !!
>
>Gerard
>
>
>
>
>>>I am trying to use a multiple OR statement in c# but am getting
>>>..cannot be applied to operands of type bool and type string
>>>
>>>I am trying to (in VFP code)
>>>if Mynum2 = "C" or MyNum2 = "E" .....
>>>
>>>My c~ code is:
>>>if ( (MyNum2 == "C") || (MyNum2 == "E") )
>>>
>>>and MyNum2 is declared as string.
>>>
>>>Any help appreciated.
>>>
>>>Gerard
>>>
>>
>>Try using single quotation mark (') instead of double (").

Haven't worked much with C# (yet), and I haven't worked with C in quite awhile. But If those are strings, I think you'll need a function to compare the values (in C strcmp(), if I remember). In C# (from the help) (Spanish culture)
 // Uses GetCompareInfo to create the CompareInfo that uses the "es-ES" culture with traditional sort.
      CompareInfo myCompTrad = CompareInfo.GetCompareInfo( 0x040A );
      if (myCompTrad.Compare(MyNum2, "C")==1 || myCompTrad.Compare(MyNum2, "E")==1)
// strings match
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform