473,385 Members | 1,320 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.

Ignore case sensitive

Hi,

I currently have this code:

Expand|Select|Wrap|Line Numbers
  1. If IO.File.Exists(txt_Path.Text & "\names.txt") Then
  2. SaveSetting("Search", "Main", "Found", "1")
  3. MessageBox.Show("Found names.txt")
  4. btn_Edit.Enabled = True
  5. Else
  6. SaveSetting("Search", "Main", "Found", "0")
  7. MessageBox.Show("Could not find names.txt")
  8. End If
  9.  
But my problem is that "names.txt" can be: Names.txt, NAMES.TXT, NaMeS.TxT, anything.

How do I make sure that it will just find "names.txt", ignoring difference between capitals or lower case letters ?


Thanks in advance,
Evolution445
Jan 23 '09 #1
5 5703
Plater
7,872 Expert 4TB
Well you'd have to move to a non-windows system for starters.
Windows doesn't differentiate on case at the filesystem level.
Try and make a file called mytxt.txt and Mytxt.txt in the same directory, it won't let you.
Jan 23 '09 #2
balabaster
797 Expert 512MB
Am I understanding that you correctly?

The file name as it is stored on the file system is "names.txt" in all lower case, but the user may enter the search file name as "Names.txt" and vice versa?

It may be stored as "Names.txt" and the user enters "names.txt" and it should still find the file?

System.IO.File.Exists() is not case sensitive. As such, it should return true regardless of the case of the file name provided and the file name on the file system. If for instance, the file was called "names.txt" on the file system and you provided "NaMeS.tXt" as the input parameter to File.Exists(), it would still return true.
Jan 23 '09 #3
Thanks for your quick replies.

I feel stupid now. I forgot to add "= True". I just had:
If IO.File.Exists() Then

It now is:
If IO.File.Exists() = True Then

And now is working as it should.


Thanks again.
Evolution445
Jan 23 '09 #4
Curtis Rutland
3,256 Expert 2GB
That shouldn't matter at all. A boolean value is a boolean value. True = True evaluates to True.
Jan 24 '09 #5
I put names.txt in my directory, it got picked up. Then renamed it to NaMeS.TxT, and it told me it wasnt there. Then added "= True", and "Import System.IO" at the top, and it found the file straight away. Maybe in rush I mis-spelled the file, or I made an error somewhere else.
Jan 24 '09 #6

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

Similar topics

1
by: Mosas | last post by:
Dear All In Perl when we are checking some conditions using regular expression we can ignore the case sensitive of a string using the following regular expression /(^)|/|(\.\.)/i. But If I try...
32
by: Elliot Temple | last post by:
Hi I have two questions. Could someone explain to me why Python is case sensitive? I find that annoying. Also, why aren't there multiline comments? Would adding them cause a problem of some...
9
by: Paul Smith | last post by:
This doesn't seem like it should be *that* difficult, but after quite some time trying to figure it out, I'm still banging my head against the wall. My objective is to examine the exact...
5
by: Madjid Nasiri | last post by:
Hi, I am basic in oracle. My Old programs write with Delphi and Databases: Access, Paradox, MySQL, Microsoft SQL. I write my code (SQL code) case-insensitivae, but now i need use oracle database....
2
by: J. Muenchbourg | last post by:
I'm doing a few tests with simple .net scripts, and I noticed that I display the following error message at ErrMessage.Text if I don't enter "BLUE" in capital letters into my input textbox: ...
2
by: Pierre | last post by:
Hello, I would like to write a regexp that can be either case sensitive or that can ignore the case based on a variable (value would be either 'i' or ''). For instance in the below code the...
4
by: xAvailx | last post by:
Hello: I didn't find any documentation that notes save point names are case sensitive, but I guess they are... Stored Proc to reproduce: /* START CODE SNIPPET */ If Exists (Select * From...
38
by: Bart | last post by:
Why is C case sensitive? I know it's a bit late to change it now but there would seem to be far more advantages in ignoring letter case in source code. In real life such a situation would be...
2
by: Vinnie123 | last post by:
Is it possible to have mysql ignore the case when performing a search? I am making a user signup script. I want the usernames to be case sensitive (i.e. I do not want to store only lowercase...
11
by: Rafe | last post by:
Hi, I'm working within an application (making a lot of wrappers), but the application is not case sensitive. For example, Typing obj.name, obj.Name, or even object.naMe is all fine (as far as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.