473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Option Compare Text Not Working!

105 100+
I am trying to use Option Compare Text in Visual Studio 2008. Can you not use Option Compare Text at the top of the code in Visual C#? It doesn't recognize it.

Thanks for your help!
Nov 12 '09 #1
4 3833
Plater
7,872 Expert 4TB
Option Compare Text is VB only and therefor doesn't apply to C#, nor should you be using it in your .NET projects actually. You should have got compiler errors for it
Nov 13 '09 #2
jmarcrum
105 100+
I'm not sure that is entirely accurate.. have you investigated before posting? This is my code...

Expand|Select|Wrap|Line Numbers
  1. //Get the name of the link to save 
  2. string origName = fuImgs.FileName;
  3. string linkName = origName.Replace(".JPG", ".lnk");
  4.  
If I put ".JPG" in lowercase ~ ".jpg" it doesn't replace.

Did you test your theory? I am using Visual Studio 2008 ~ Visual C#
Nov 14 '09 #3
Plater
7,872 Expert 4TB
If by theory I went to MSDN and checked, then yes.
"Option" is a vb word. There might be a C# version of it, but I saw no references to it

Your example had nothing to do with proving or disproving any statement.

Your initial post was about Compare, String.Compare contains overloads for ignoring case. .Replace does not. You may have to force a case on the string, or do your own custom replace.
.IndexOf() and .EndsWith() both have the option to ignore case
Nov 16 '09 #4
jmarcrum
105 100+
That got it...

Thanks Plater!

Expand|Select|Wrap|Line Numbers
  1. string imgTest = fuImgs.FileName;
  2. bool answer = imgTest.EndsWith(".jpg", StringComparison.CurrentCultureIgnoreCase);
  3.  
Nov 17 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
4
by: Mark Kolber | last post by:
I did a little searching on this but couldn't find an answer... On my website, I have a section of stories (www.midlifeflight.com/stories) There are different stores on different pages that are...
0
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
1
by: Linda | last post by:
Hi, Is there a way to do a "text" (rather than "binary") compareison with the "like" operator, without changing the global "Option Compare" setting? I don't want to risk breaking many, many...
4
by: John | last post by:
Hi I have a vs 2003 project which I have just imported into vs 2005. Now I am getting the "Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for...
0
by: Michael Jenck | last post by:
Hi All, I have been playing with the codedom and can't get it to output for option compare Binary with a CodeCompileUnit. I have searched the web and Don't now if it's possible. If it's not...
8
by: Perl Beginner | last post by:
I am new to Perl and new to this site. I have the same question that I keep seeing, but not finding an answer…why doesn’t the compare function work? I’ve been going at this for a while. My code is...
2
by: sabrinakr | last post by:
Hi All, I have spent a long time on this and still cant figure out whats wrong. I have recently started with javscript and my question is as follows: The page works fine but if the User...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.