Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do You Compare Strings In C#?
Message
 
To
07/01/2005 10:06:29
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00975060
Message ID:
00975093
Views:
15
You have the right idea, but the keyword int is equal to System.Int32 and you convert it using Conver.ToInt16 and the max value for Int16 is 32767. Use Conver.ToInt32 instead:
int nD1 = Convert.ToInt32(d1);
int nD2 = Convert.ToInt32(d2);

if (nD1 < nD2)
  MessageBox.Show("nD1 is less than nD2");
else
  MessageBox.Show("nD1 is NOT less than nD2");
Einar


>Sounds like it should be fairly simple...
>
>
>int nD1 = Convert.ToInt16(d1);
>int nD2 = Convert.ToInt16(d2);
>
>if (nD1 < nD2) {return -1;}
>
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform