Hi,
I currently have this code: -
If IO.File.Exists(txt_Path.Text & "\names.txt") Then
-
SaveSetting("Search", "Main", "Found", "1")
-
MessageBox.Show("Found names.txt")
-
btn_Edit.Enabled = True
-
Else
-
SaveSetting("Search", "Main", "Found", "0")
-
MessageBox.Show("Could not find names.txt")
-
End If
-
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
5 5703
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.
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.
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
That shouldn't matter at all. A boolean value is a boolean value. True = True evaluates to True.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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....
|
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:
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |