vj_mi
asked on
Making VB.NET code case insensitive
Hi,
Using VB.NET, I have following field in my hash table:
Account_Nr and Bankcode.
Now, I later read the values using:
x = htab_Accounts.Item("BankCo de")
Now x has value of Nothing. When I did some exploration, I found that because the character case for C in BankCode. Like when I add the field to hastable, I use C in lower case and when I try to read later, I use C in upper case. I do not want my code to be case sensitive. SO I used Tools->Options and set the Option Compare to Text. But still this is not making any difference. Is there any way I can make my code insensitve to char case?
Regards,
MI
Using VB.NET, I have following field in my hash table:
Account_Nr and Bankcode.
Now, I later read the values using:
x = htab_Accounts.Item("BankCo
Now x has value of Nothing. When I did some exploration, I found that because the character case for C in BankCode. Like when I add the field to hastable, I use C in lower case and when I try to read later, I use C in upper case. I do not want my code to be case sensitive. SO I used Tools->Options and set the Option Compare to Text. But still this is not making any difference. Is there any way I can make my code insensitve to char case?
Regards,
MI
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It does not work since I check it like this:
if htab_Accounts.Item("BankCo de") ="" then Return.
In this case, because it is case sensitive, the above "if htab_Accounts.Item("BankCo de") " returns Nothing. I found that the same problems are with grid columns. In Vs 2003, they are not case sensitive. I do not know why suddenly in Vs 2005 they are case sensitive. Is there any way I can make my project case-insensitive?
Regards,
MI
if htab_Accounts.Item("BankCo
In this case, because it is case sensitive, the above "if htab_Accounts.Item("BankCo
Regards,
MI
If you aren't adding to the Hashtable with an upper-case key, and retrieving with an upper-case key, then it won't work.
Bob
Bob
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Bob;
I would like to see a resolution to this question seeming that both experts provided a solution to the problem. I would like to see a point split.
Thanks;
Fernando
I would like to see a resolution to this question seeming that both experts provided a solution to the problem. I would like to see a point split.
Thanks;
Fernando
Because the HashTable uses a hash function to store the key it can not do a hash function on every combination of characters to check to see if it exist. A work around would be to convert the Key you use for the TashTable to upper case or lower case and when you check to see if there is a key you are looking form convert the string to Upper/Lower case with the string function, for example:
x = htab_Accounts.Item("BankCo
Fernando